@ssml-builder-js/azure-tts-client 2.16.0 → 2.17.0

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @ssml-builder-js/azure-tts-client
2
2
 
3
+ ## 2.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add resilient chunk synthesis with aggregate validation diagnostics, custom merge/post-merge hooks, Retry-After-aware retries, structured timeouts, cancellation/resume partial results, expanded audio specifications, and voice-capability-aware Visual Editor controls.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @ssml-builder-js/ssml-core@2.17.0
13
+
3
14
  ## 2.16.0
4
15
 
5
16
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -49,6 +49,7 @@ declare function resolveMimeType(outputFormat: string): string;
49
49
  interface TtsConfig {
50
50
  signal?: AbortSignal;
51
51
  timeoutMs?: number;
52
+ timeouts?: SynthesisTimeouts;
52
53
  endpoint?: string;
53
54
  subscriptionKey: string;
54
55
  region: string;
@@ -68,6 +69,12 @@ interface TtsConfig {
68
69
  sourceMarkers?: SsmlSourceMarker[];
69
70
  concurrency?: number;
70
71
  retryOptions?: RetryOptions;
72
+ cancelOnFailure?: boolean;
73
+ resumeChunks?: readonly SynthesizedChunk[];
74
+ resumeChunkIndices?: readonly number[];
75
+ customMerger?: CustomAudioMerger;
76
+ outputMimeType?: string;
77
+ postMergeValidator?: PostMergeValidator;
71
78
  }
72
79
  type MappingStatus = "exact" | "fallback" | "unmapped";
73
80
  interface AudioSpecification {
@@ -77,12 +84,22 @@ interface AudioSpecification {
77
84
  sampleRate: number;
78
85
  channels: number;
79
86
  bitrate?: number;
87
+ bitDepth?: number;
88
+ container?: string;
89
+ isVbr?: boolean;
80
90
  isCompressed: boolean;
81
91
  }
92
+ interface SynthesisTimeouts {
93
+ urlValidationMs?: number;
94
+ perChunkMs?: number;
95
+ chunkWithRetriesMs?: number;
96
+ totalJobMs?: number;
97
+ }
82
98
  interface RetryOptions {
83
99
  maxRetries: number;
84
100
  initialDelayMs: number;
85
101
  maxDelayMs: number;
102
+ shouldRetry?: (error: unknown, attempt: number) => boolean;
86
103
  }
87
104
  type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
88
105
  interface SsmlSynthesisBoundary {
@@ -172,10 +189,37 @@ interface SynthesizeChunksOptions {
172
189
  outputFormat?: AzureTtsOutputFormat | string;
173
190
  signal?: AbortSignal;
174
191
  timeoutMs?: number;
192
+ timeouts?: SynthesisTimeouts;
175
193
  sourceNodePath?: string[];
176
194
  concurrency?: number;
177
195
  retryOptions?: RetryOptions;
196
+ cancelOnFailure?: boolean;
197
+ resumeChunks?: readonly SynthesizedChunk[];
198
+ resumeChunkIndices?: readonly number[];
199
+ customMerger?: CustomAudioMerger;
200
+ outputMimeType?: string;
201
+ postMergeValidator?: PostMergeValidator;
202
+ }
203
+ interface CustomMergerContext {
204
+ format: string;
205
+ outputMimeType: string;
206
+ inputSpecs: readonly AudioSpecification[];
207
+ signal: AbortSignal;
208
+ }
209
+ type CustomAudioMerger = (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
210
+ type PostMergeValidator = (result: MergedSynthesisResult, context: CustomMergerContext) => boolean | undefined | Promise<boolean | undefined>;
211
+ interface SynthesizedChunk extends SsmlSynthesisResult {
212
+ chunkIndex: number;
213
+ }
214
+ interface PartialChunkSynthesisResult {
215
+ synthesizedChunks: readonly SynthesizedChunk[];
216
+ completedChunks: readonly SynthesizedChunk[];
217
+ pendingChunkIndices: readonly number[];
218
+ failedChunkIndices: readonly number[];
219
+ totalChunks: number;
178
220
  }
221
+ /** Alias for applications that use the shorter result name. */
222
+ type PartialSynthesisResult = PartialChunkSynthesisResult;
179
223
  interface SynthesisProgressEvent {
180
224
  /** 1-based completed chunk count retained for backward compatibility. */
181
225
  currentChunk: number;
@@ -199,6 +243,7 @@ interface AzureTtsLogger {
199
243
  interface AzureTtsClientOptions {
200
244
  signal?: AbortSignal;
201
245
  timeoutMs?: number;
246
+ timeouts?: SynthesisTimeouts;
202
247
  subscriptionKey: string;
203
248
  region: string;
204
249
  endpoint?: string;
@@ -216,8 +261,11 @@ declare class AzureTtsError extends Error {
216
261
  readonly statusText: string;
217
262
  readonly responseBody: string;
218
263
  readonly requestId: string | null;
219
- constructor(status: number, statusText: string, responseBody: string, requestId: string | null);
264
+ readonly retryAfterMs?: number;
265
+ constructor(status: number, statusText: string, responseBody: string, requestId: string | null, responseHeaders?: Headers | Readonly<Record<string, string>>);
220
266
  }
267
+ /** Reads Retry-After from an error-like value, returning milliseconds when present. */
268
+ declare function getRetryAfterDelayMs(error: unknown): number | undefined;
221
269
  declare class AzureTtsSdkError extends AzureTtsError {
222
270
  readonly errorDetails: string;
223
271
  constructor(errorDetails: string);
@@ -261,6 +309,17 @@ declare class ChunkValidationError extends Error {
261
309
  readonly diagnostics: readonly SsmlDiagnostic[];
262
310
  constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
263
311
  }
312
+ interface ChunkDiagnostics {
313
+ readonly chunkIndex: number;
314
+ readonly diagnostics: readonly SsmlDiagnostic[];
315
+ }
316
+ declare class BatchChunkValidationError extends ChunkValidationError {
317
+ readonly chunkDiagnostics: readonly ChunkDiagnostics[];
318
+ readonly totalErrorCount: number;
319
+ readonly errorCount: number;
320
+ readonly totalErrors: number;
321
+ constructor(chunkDiagnostics: readonly ChunkDiagnostics[]);
322
+ }
264
323
  type Result<T, E> = {
265
324
  readonly ok: true;
266
325
  readonly success: true;
@@ -273,11 +332,13 @@ type Result<T, E> = {
273
332
  readonly success: false;
274
333
  readonly status: Kind;
275
334
  readonly error: E;
335
+ readonly partialResult?: PartialChunkSynthesisResult;
276
336
  } : {
277
337
  readonly ok: false;
278
338
  readonly success: false;
279
339
  readonly status: SynthesisErrorKind;
280
340
  readonly error: E;
341
+ readonly partialResult?: PartialChunkSynthesisResult;
281
342
  });
282
343
  type SynthesisResult<T, E> = Result<T, E>;
283
344
  type Success<T> = Extract<Result<T, never>, {
@@ -294,18 +355,26 @@ interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
294
355
  /** Optional nested form for callers that want to keep validation settings grouped. */
295
356
  validation?: AzureValidationOptions;
296
357
  signal?: AbortSignal;
358
+ timeouts?: SynthesisTimeouts;
297
359
  }
298
360
  interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
299
361
  validation?: AzureValidationOptions;
300
362
  outputFormat?: string;
301
363
  signal?: AbortSignal;
302
364
  timeoutMs?: number;
365
+ timeouts?: SynthesisTimeouts;
303
366
  sourceNodePath?: string[];
304
367
  onProgress?: (event: SynthesisProgressEvent) => void;
305
368
  concurrency?: number;
306
369
  retryOptions?: RetryOptions;
370
+ cancelOnFailure?: boolean;
371
+ resumeChunks?: readonly SynthesizedChunk[];
372
+ resumeChunkIndices?: readonly number[];
373
+ customMerger?: CustomAudioMerger;
374
+ outputMimeType?: string;
375
+ postMergeValidator?: PostMergeValidator;
307
376
  }
308
- type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
377
+ type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, BatchChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
309
378
  interface SynthesisClient {
310
379
  synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
311
380
  synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
@@ -333,14 +402,9 @@ interface MergeAudioOptions {
333
402
  outputMimeType?: string;
334
403
  }
335
404
  type InputAudioSpecs = AudioSpecification[];
336
- interface CustomMergerContext {
337
- format: string;
338
- outputMimeType: string;
339
- inputSpecs: InputAudioSpecs;
340
- signal: AbortSignal;
341
- }
342
405
  interface MergeSynthesisOptions extends MergeAudioOptions {
343
- customMerger?: (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
406
+ customMerger?: CustomAudioMerger;
407
+ postMergeValidator?: PostMergeValidator;
344
408
  }
345
409
  type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
346
410
  customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
@@ -356,6 +420,7 @@ declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSy
356
420
  /** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
357
421
  declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
358
422
  declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
423
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeSynthesisOptions): MergedSynthesisResult | Promise<MergedSynthesisResult>;
359
424
  declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
360
425
  /** Backward-compatible audio-only synthesis helper. */
361
426
  declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
@@ -380,6 +445,8 @@ interface FetchedAzureVoiceCatalogMetadata {
380
445
  generatedAt: string;
381
446
  apiVersion: string;
382
447
  regions: readonly string[];
448
+ expiresAt?: string;
449
+ regionDiffs?: Readonly<Record<string, readonly string[]>>;
383
450
  }
384
451
  interface AzureVoiceCatalog {
385
452
  voices: readonly AzureVoiceCatalogVoice[];
@@ -388,4 +455,4 @@ interface AzureVoiceCatalog {
388
455
  /** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
389
456
  declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
390
457
 
391
- export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type Result, type RetryOptions, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
458
+ export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, BatchChunkValidationError, type ChunkDiagnostics, ChunkValidationError, type CustomAudioMerger, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type PartialChunkSynthesisResult, type PartialSynthesisResult, type PostMergeValidator, type Result, type RetryOptions, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesisTimeouts, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type SynthesizedChunk, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, getRetryAfterDelayMs, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ declare function resolveMimeType(outputFormat: string): string;
49
49
  interface TtsConfig {
50
50
  signal?: AbortSignal;
51
51
  timeoutMs?: number;
52
+ timeouts?: SynthesisTimeouts;
52
53
  endpoint?: string;
53
54
  subscriptionKey: string;
54
55
  region: string;
@@ -68,6 +69,12 @@ interface TtsConfig {
68
69
  sourceMarkers?: SsmlSourceMarker[];
69
70
  concurrency?: number;
70
71
  retryOptions?: RetryOptions;
72
+ cancelOnFailure?: boolean;
73
+ resumeChunks?: readonly SynthesizedChunk[];
74
+ resumeChunkIndices?: readonly number[];
75
+ customMerger?: CustomAudioMerger;
76
+ outputMimeType?: string;
77
+ postMergeValidator?: PostMergeValidator;
71
78
  }
72
79
  type MappingStatus = "exact" | "fallback" | "unmapped";
73
80
  interface AudioSpecification {
@@ -77,12 +84,22 @@ interface AudioSpecification {
77
84
  sampleRate: number;
78
85
  channels: number;
79
86
  bitrate?: number;
87
+ bitDepth?: number;
88
+ container?: string;
89
+ isVbr?: boolean;
80
90
  isCompressed: boolean;
81
91
  }
92
+ interface SynthesisTimeouts {
93
+ urlValidationMs?: number;
94
+ perChunkMs?: number;
95
+ chunkWithRetriesMs?: number;
96
+ totalJobMs?: number;
97
+ }
82
98
  interface RetryOptions {
83
99
  maxRetries: number;
84
100
  initialDelayMs: number;
85
101
  maxDelayMs: number;
102
+ shouldRetry?: (error: unknown, attempt: number) => boolean;
86
103
  }
87
104
  type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
88
105
  interface SsmlSynthesisBoundary {
@@ -172,10 +189,37 @@ interface SynthesizeChunksOptions {
172
189
  outputFormat?: AzureTtsOutputFormat | string;
173
190
  signal?: AbortSignal;
174
191
  timeoutMs?: number;
192
+ timeouts?: SynthesisTimeouts;
175
193
  sourceNodePath?: string[];
176
194
  concurrency?: number;
177
195
  retryOptions?: RetryOptions;
196
+ cancelOnFailure?: boolean;
197
+ resumeChunks?: readonly SynthesizedChunk[];
198
+ resumeChunkIndices?: readonly number[];
199
+ customMerger?: CustomAudioMerger;
200
+ outputMimeType?: string;
201
+ postMergeValidator?: PostMergeValidator;
202
+ }
203
+ interface CustomMergerContext {
204
+ format: string;
205
+ outputMimeType: string;
206
+ inputSpecs: readonly AudioSpecification[];
207
+ signal: AbortSignal;
208
+ }
209
+ type CustomAudioMerger = (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
210
+ type PostMergeValidator = (result: MergedSynthesisResult, context: CustomMergerContext) => boolean | undefined | Promise<boolean | undefined>;
211
+ interface SynthesizedChunk extends SsmlSynthesisResult {
212
+ chunkIndex: number;
213
+ }
214
+ interface PartialChunkSynthesisResult {
215
+ synthesizedChunks: readonly SynthesizedChunk[];
216
+ completedChunks: readonly SynthesizedChunk[];
217
+ pendingChunkIndices: readonly number[];
218
+ failedChunkIndices: readonly number[];
219
+ totalChunks: number;
178
220
  }
221
+ /** Alias for applications that use the shorter result name. */
222
+ type PartialSynthesisResult = PartialChunkSynthesisResult;
179
223
  interface SynthesisProgressEvent {
180
224
  /** 1-based completed chunk count retained for backward compatibility. */
181
225
  currentChunk: number;
@@ -199,6 +243,7 @@ interface AzureTtsLogger {
199
243
  interface AzureTtsClientOptions {
200
244
  signal?: AbortSignal;
201
245
  timeoutMs?: number;
246
+ timeouts?: SynthesisTimeouts;
202
247
  subscriptionKey: string;
203
248
  region: string;
204
249
  endpoint?: string;
@@ -216,8 +261,11 @@ declare class AzureTtsError extends Error {
216
261
  readonly statusText: string;
217
262
  readonly responseBody: string;
218
263
  readonly requestId: string | null;
219
- constructor(status: number, statusText: string, responseBody: string, requestId: string | null);
264
+ readonly retryAfterMs?: number;
265
+ constructor(status: number, statusText: string, responseBody: string, requestId: string | null, responseHeaders?: Headers | Readonly<Record<string, string>>);
220
266
  }
267
+ /** Reads Retry-After from an error-like value, returning milliseconds when present. */
268
+ declare function getRetryAfterDelayMs(error: unknown): number | undefined;
221
269
  declare class AzureTtsSdkError extends AzureTtsError {
222
270
  readonly errorDetails: string;
223
271
  constructor(errorDetails: string);
@@ -261,6 +309,17 @@ declare class ChunkValidationError extends Error {
261
309
  readonly diagnostics: readonly SsmlDiagnostic[];
262
310
  constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
263
311
  }
312
+ interface ChunkDiagnostics {
313
+ readonly chunkIndex: number;
314
+ readonly diagnostics: readonly SsmlDiagnostic[];
315
+ }
316
+ declare class BatchChunkValidationError extends ChunkValidationError {
317
+ readonly chunkDiagnostics: readonly ChunkDiagnostics[];
318
+ readonly totalErrorCount: number;
319
+ readonly errorCount: number;
320
+ readonly totalErrors: number;
321
+ constructor(chunkDiagnostics: readonly ChunkDiagnostics[]);
322
+ }
264
323
  type Result<T, E> = {
265
324
  readonly ok: true;
266
325
  readonly success: true;
@@ -273,11 +332,13 @@ type Result<T, E> = {
273
332
  readonly success: false;
274
333
  readonly status: Kind;
275
334
  readonly error: E;
335
+ readonly partialResult?: PartialChunkSynthesisResult;
276
336
  } : {
277
337
  readonly ok: false;
278
338
  readonly success: false;
279
339
  readonly status: SynthesisErrorKind;
280
340
  readonly error: E;
341
+ readonly partialResult?: PartialChunkSynthesisResult;
281
342
  });
282
343
  type SynthesisResult<T, E> = Result<T, E>;
283
344
  type Success<T> = Extract<Result<T, never>, {
@@ -294,18 +355,26 @@ interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
294
355
  /** Optional nested form for callers that want to keep validation settings grouped. */
295
356
  validation?: AzureValidationOptions;
296
357
  signal?: AbortSignal;
358
+ timeouts?: SynthesisTimeouts;
297
359
  }
298
360
  interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
299
361
  validation?: AzureValidationOptions;
300
362
  outputFormat?: string;
301
363
  signal?: AbortSignal;
302
364
  timeoutMs?: number;
365
+ timeouts?: SynthesisTimeouts;
303
366
  sourceNodePath?: string[];
304
367
  onProgress?: (event: SynthesisProgressEvent) => void;
305
368
  concurrency?: number;
306
369
  retryOptions?: RetryOptions;
370
+ cancelOnFailure?: boolean;
371
+ resumeChunks?: readonly SynthesizedChunk[];
372
+ resumeChunkIndices?: readonly number[];
373
+ customMerger?: CustomAudioMerger;
374
+ outputMimeType?: string;
375
+ postMergeValidator?: PostMergeValidator;
307
376
  }
308
- type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
377
+ type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, BatchChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
309
378
  interface SynthesisClient {
310
379
  synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
311
380
  synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
@@ -333,14 +402,9 @@ interface MergeAudioOptions {
333
402
  outputMimeType?: string;
334
403
  }
335
404
  type InputAudioSpecs = AudioSpecification[];
336
- interface CustomMergerContext {
337
- format: string;
338
- outputMimeType: string;
339
- inputSpecs: InputAudioSpecs;
340
- signal: AbortSignal;
341
- }
342
405
  interface MergeSynthesisOptions extends MergeAudioOptions {
343
- customMerger?: (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
406
+ customMerger?: CustomAudioMerger;
407
+ postMergeValidator?: PostMergeValidator;
344
408
  }
345
409
  type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
346
410
  customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
@@ -356,6 +420,7 @@ declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSy
356
420
  /** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
357
421
  declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
358
422
  declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
423
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeSynthesisOptions): MergedSynthesisResult | Promise<MergedSynthesisResult>;
359
424
  declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
360
425
  /** Backward-compatible audio-only synthesis helper. */
361
426
  declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
@@ -380,6 +445,8 @@ interface FetchedAzureVoiceCatalogMetadata {
380
445
  generatedAt: string;
381
446
  apiVersion: string;
382
447
  regions: readonly string[];
448
+ expiresAt?: string;
449
+ regionDiffs?: Readonly<Record<string, readonly string[]>>;
383
450
  }
384
451
  interface AzureVoiceCatalog {
385
452
  voices: readonly AzureVoiceCatalogVoice[];
@@ -388,4 +455,4 @@ interface AzureVoiceCatalog {
388
455
  /** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
389
456
  declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
390
457
 
391
- export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type Result, type RetryOptions, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
458
+ export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, BatchChunkValidationError, type ChunkDiagnostics, ChunkValidationError, type CustomAudioMerger, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type PartialChunkSynthesisResult, type PartialSynthesisResult, type PostMergeValidator, type Result, type RetryOptions, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesisTimeouts, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type SynthesizedChunk, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, getRetryAfterDelayMs, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };