web-speech-cognitive-services 8.1.2 → 8.1.3-main.b33949a

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.
@@ -1,6 +1,7 @@
1
1
  import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
2
2
  import * as valibot from 'valibot';
3
3
  import { InferOutput } from 'valibot';
4
+ import * as memoize_one from 'memoize-one';
4
5
 
5
6
  type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';
6
7
  type SpeechRecognitionErrorEventInit = {
@@ -23,7 +24,7 @@ declare class FakeArray<T> implements FakeArrayInterface<T> {
23
24
  #private;
24
25
  constructor(array: readonly T[]);
25
26
  [index: number]: T | undefined;
26
- [Symbol.iterator](): IterableIterator<T>;
27
+ [Symbol.iterator](): ArrayIterator<T>;
27
28
  get length(): number;
28
29
  }
29
30
 
@@ -117,38 +118,38 @@ declare class SpeechGrammarList implements W3CSpeechGrammarList {
117
118
  set phrases(value: readonly string[]);
118
119
  }
119
120
 
120
- declare const credentialsSchema: valibot.SchemaWithPipe<[valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
121
+ declare const credentialsSchema: valibot.SchemaWithPipe<readonly [valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
121
122
  readonly authorizationToken: valibot.StringSchema<undefined>;
122
- readonly subscriptionKey: valibot.OptionalSchema<valibot.UndefinedSchema<"\"subscriptionKey\" must be unset when \"authorizationToken\" is set.">, never>;
123
+ readonly subscriptionKey: valibot.OptionalSchema<valibot.UndefinedSchema<"\"subscriptionKey\" must be unset when \"authorizationToken\" is set.">, undefined>;
123
124
  }, undefined>, valibot.ObjectSchema<{
124
- readonly authorizationToken: valibot.OptionalSchema<valibot.UndefinedSchema<"\"authorizationToken\" must be unset when \"subscriptionKey\" is set.">, never>;
125
+ readonly authorizationToken: valibot.OptionalSchema<valibot.UndefinedSchema<"\"authorizationToken\" must be unset when \"subscriptionKey\" is set.">, undefined>;
125
126
  readonly subscriptionKey: valibot.StringSchema<undefined>;
126
127
  }, undefined>], "The object must either have either \"authorizationToken\" or \"subscriptionKey\" set, but not both.">, valibot.UnionSchema<[valibot.ObjectSchema<{
127
- readonly customVoiceHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"customVoiceHostname\" must be unest when \"region\" is set.">, never>;
128
+ readonly customVoiceHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"customVoiceHostname\" must be unest when \"region\" is set.">, undefined>;
128
129
  readonly region: valibot.StringSchema<undefined>;
129
- readonly speechRecognitionHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechRecognitionHostname\" must be unest when \"region\" is set.">, never>;
130
- readonly speechSynthesisHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechSynthesisHostname\" must be unest when \"region\" is set.">, never>;
130
+ readonly speechRecognitionHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechRecognitionHostname\" must be unest when \"region\" is set.">, undefined>;
131
+ readonly speechSynthesisHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechSynthesisHostname\" must be unest when \"region\" is set.">, undefined>;
131
132
  }, undefined>, valibot.ObjectSchema<{
132
- readonly customVoiceHostname: valibot.OptionalSchema<valibot.UnionSchema<[valibot.StringSchema<undefined>, valibot.UndefinedSchema<undefined>], undefined>, never>;
133
- readonly region: valibot.OptionalSchema<valibot.UndefinedSchema<"\"region\" must be unset when \"*Hostname\" is set.">, never>;
133
+ readonly customVoiceHostname: valibot.OptionalSchema<valibot.UnionSchema<[valibot.StringSchema<undefined>, valibot.UndefinedSchema<undefined>], undefined>, undefined>;
134
+ readonly region: valibot.OptionalSchema<valibot.UndefinedSchema<"\"region\" must be unset when \"*Hostname\" is set.">, undefined>;
134
135
  readonly speechRecognitionHostname: valibot.StringSchema<undefined>;
135
136
  readonly speechSynthesisHostname: valibot.StringSchema<undefined>;
136
137
  }, undefined>], "The object must either have either \"region\" or \"*Hostname\" set, but not both.">], undefined>, valibot.ReadonlyAction<({
137
138
  authorizationToken: string;
138
139
  subscriptionKey?: undefined;
139
140
  } | {
140
- subscriptionKey: string;
141
141
  authorizationToken?: undefined;
142
+ subscriptionKey: string;
142
143
  }) & ({
143
- region: string;
144
144
  customVoiceHostname?: undefined;
145
+ region: string;
145
146
  speechRecognitionHostname?: undefined;
146
147
  speechSynthesisHostname?: undefined;
147
148
  } | {
148
- speechRecognitionHostname: string;
149
- speechSynthesisHostname: string;
150
149
  customVoiceHostname?: string | undefined;
151
150
  region?: undefined;
151
+ speechRecognitionHostname: string;
152
+ speechSynthesisHostname: string;
152
153
  })>]>;
153
154
 
154
155
  type Credentials = InferOutput<typeof credentialsSchema>;
@@ -199,9 +200,9 @@ declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
199
200
  stop: (() => void) | undefined;
200
201
  start(): void;
201
202
  _startOnce(): Promise<void>;
202
- addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
203
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
203
204
  dispatchEvent(event: Event): boolean;
204
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
205
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
205
206
  };
206
207
  };
207
208
  SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
@@ -232,8 +233,8 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
232
233
  interimResults: boolean;
233
234
  maxAlternatives: number;
234
235
  lang: string;
235
- get onaudioend(): ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined;
236
- set onaudioend(value: ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined);
236
+ get onaudioend(): ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined;
237
+ set onaudioend(value: ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined);
237
238
  /** @type { ((event: SpeechRecognitionEvent<'audiostart'>) => void) | undefined } */
238
239
  onaudiostart: ((event: SpeechRecognitionEvent<"audiostart">) => void) | undefined;
239
240
  /** @type { ((event: SpeechRecognitionEvent<'cognitiveservices'>) => void) | undefined } */
@@ -258,14 +259,41 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
258
259
  stop: (() => void) | undefined;
259
260
  start(): void;
260
261
  _startOnce(): Promise<void>;
261
- addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
262
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
262
263
  dispatchEvent(event: Event): boolean;
263
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
264
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
264
265
  };
265
266
  };
266
267
  SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
267
268
  };
268
269
 
270
+ declare class _default$2 {
271
+ constructor(audioContext: any);
272
+ audioContext: any;
273
+ pause(): void;
274
+ resume(): void;
275
+ start(queue: any): Promise<void>;
276
+ playingUtterance: any;
277
+ stop(): void;
278
+ }
279
+
280
+ declare class _default$1 {
281
+ constructor({ audioContext, ponyfill }: {
282
+ audioContext: any;
283
+ ponyfill: any;
284
+ });
285
+ consumer: _default$2 | null;
286
+ paused: boolean;
287
+ queue: any[];
288
+ getAudioContext: memoize_one.MemoizedFn<() => any>;
289
+ pause(): void;
290
+ push(utterance: any): void;
291
+ resume(): void;
292
+ get speaking(): boolean;
293
+ startConsumer(): Promise<void>;
294
+ stop(): void;
295
+ }
296
+
269
297
  declare class SpeechSynthesisEvent {
270
298
  constructor(type: any);
271
299
  }
@@ -319,7 +347,7 @@ declare function _default(options: any): {
319
347
  SpeechSynthesisUtterance?: never;
320
348
  } | {
321
349
  speechSynthesis: {
322
- queue: AudioContextQueue;
350
+ queue: _default$1;
323
351
  cancel(): void;
324
352
  getVoices(): any[];
325
353
  onvoiceschanged: any;
@@ -1,6 +1,7 @@
1
1
  import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
2
2
  import * as valibot from 'valibot';
3
3
  import { InferOutput } from 'valibot';
4
+ import * as memoize_one from 'memoize-one';
4
5
 
5
6
  type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';
6
7
  type SpeechRecognitionErrorEventInit = {
@@ -23,7 +24,7 @@ declare class FakeArray<T> implements FakeArrayInterface<T> {
23
24
  #private;
24
25
  constructor(array: readonly T[]);
25
26
  [index: number]: T | undefined;
26
- [Symbol.iterator](): IterableIterator<T>;
27
+ [Symbol.iterator](): ArrayIterator<T>;
27
28
  get length(): number;
28
29
  }
29
30
 
@@ -117,38 +118,38 @@ declare class SpeechGrammarList implements W3CSpeechGrammarList {
117
118
  set phrases(value: readonly string[]);
118
119
  }
119
120
 
120
- declare const credentialsSchema: valibot.SchemaWithPipe<[valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
121
+ declare const credentialsSchema: valibot.SchemaWithPipe<readonly [valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
121
122
  readonly authorizationToken: valibot.StringSchema<undefined>;
122
- readonly subscriptionKey: valibot.OptionalSchema<valibot.UndefinedSchema<"\"subscriptionKey\" must be unset when \"authorizationToken\" is set.">, never>;
123
+ readonly subscriptionKey: valibot.OptionalSchema<valibot.UndefinedSchema<"\"subscriptionKey\" must be unset when \"authorizationToken\" is set.">, undefined>;
123
124
  }, undefined>, valibot.ObjectSchema<{
124
- readonly authorizationToken: valibot.OptionalSchema<valibot.UndefinedSchema<"\"authorizationToken\" must be unset when \"subscriptionKey\" is set.">, never>;
125
+ readonly authorizationToken: valibot.OptionalSchema<valibot.UndefinedSchema<"\"authorizationToken\" must be unset when \"subscriptionKey\" is set.">, undefined>;
125
126
  readonly subscriptionKey: valibot.StringSchema<undefined>;
126
127
  }, undefined>], "The object must either have either \"authorizationToken\" or \"subscriptionKey\" set, but not both.">, valibot.UnionSchema<[valibot.ObjectSchema<{
127
- readonly customVoiceHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"customVoiceHostname\" must be unest when \"region\" is set.">, never>;
128
+ readonly customVoiceHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"customVoiceHostname\" must be unest when \"region\" is set.">, undefined>;
128
129
  readonly region: valibot.StringSchema<undefined>;
129
- readonly speechRecognitionHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechRecognitionHostname\" must be unest when \"region\" is set.">, never>;
130
- readonly speechSynthesisHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechSynthesisHostname\" must be unest when \"region\" is set.">, never>;
130
+ readonly speechRecognitionHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechRecognitionHostname\" must be unest when \"region\" is set.">, undefined>;
131
+ readonly speechSynthesisHostname: valibot.OptionalSchema<valibot.UndefinedSchema<"\"speechSynthesisHostname\" must be unest when \"region\" is set.">, undefined>;
131
132
  }, undefined>, valibot.ObjectSchema<{
132
- readonly customVoiceHostname: valibot.OptionalSchema<valibot.UnionSchema<[valibot.StringSchema<undefined>, valibot.UndefinedSchema<undefined>], undefined>, never>;
133
- readonly region: valibot.OptionalSchema<valibot.UndefinedSchema<"\"region\" must be unset when \"*Hostname\" is set.">, never>;
133
+ readonly customVoiceHostname: valibot.OptionalSchema<valibot.UnionSchema<[valibot.StringSchema<undefined>, valibot.UndefinedSchema<undefined>], undefined>, undefined>;
134
+ readonly region: valibot.OptionalSchema<valibot.UndefinedSchema<"\"region\" must be unset when \"*Hostname\" is set.">, undefined>;
134
135
  readonly speechRecognitionHostname: valibot.StringSchema<undefined>;
135
136
  readonly speechSynthesisHostname: valibot.StringSchema<undefined>;
136
137
  }, undefined>], "The object must either have either \"region\" or \"*Hostname\" set, but not both.">], undefined>, valibot.ReadonlyAction<({
137
138
  authorizationToken: string;
138
139
  subscriptionKey?: undefined;
139
140
  } | {
140
- subscriptionKey: string;
141
141
  authorizationToken?: undefined;
142
+ subscriptionKey: string;
142
143
  }) & ({
143
- region: string;
144
144
  customVoiceHostname?: undefined;
145
+ region: string;
145
146
  speechRecognitionHostname?: undefined;
146
147
  speechSynthesisHostname?: undefined;
147
148
  } | {
148
- speechRecognitionHostname: string;
149
- speechSynthesisHostname: string;
150
149
  customVoiceHostname?: string | undefined;
151
150
  region?: undefined;
151
+ speechRecognitionHostname: string;
152
+ speechSynthesisHostname: string;
152
153
  })>]>;
153
154
 
154
155
  type Credentials = InferOutput<typeof credentialsSchema>;
@@ -199,9 +200,9 @@ declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
199
200
  stop: (() => void) | undefined;
200
201
  start(): void;
201
202
  _startOnce(): Promise<void>;
202
- addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
203
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
203
204
  dispatchEvent(event: Event): boolean;
204
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
205
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
205
206
  };
206
207
  };
207
208
  SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
@@ -232,8 +233,8 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
232
233
  interimResults: boolean;
233
234
  maxAlternatives: number;
234
235
  lang: string;
235
- get onaudioend(): ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined;
236
- set onaudioend(value: ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined);
236
+ get onaudioend(): ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined;
237
+ set onaudioend(value: ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined);
237
238
  /** @type { ((event: SpeechRecognitionEvent<'audiostart'>) => void) | undefined } */
238
239
  onaudiostart: ((event: SpeechRecognitionEvent<"audiostart">) => void) | undefined;
239
240
  /** @type { ((event: SpeechRecognitionEvent<'cognitiveservices'>) => void) | undefined } */
@@ -258,14 +259,41 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
258
259
  stop: (() => void) | undefined;
259
260
  start(): void;
260
261
  _startOnce(): Promise<void>;
261
- addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
262
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
262
263
  dispatchEvent(event: Event): boolean;
263
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
264
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
264
265
  };
265
266
  };
266
267
  SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
267
268
  };
268
269
 
270
+ declare class _default$2 {
271
+ constructor(audioContext: any);
272
+ audioContext: any;
273
+ pause(): void;
274
+ resume(): void;
275
+ start(queue: any): Promise<void>;
276
+ playingUtterance: any;
277
+ stop(): void;
278
+ }
279
+
280
+ declare class _default$1 {
281
+ constructor({ audioContext, ponyfill }: {
282
+ audioContext: any;
283
+ ponyfill: any;
284
+ });
285
+ consumer: _default$2 | null;
286
+ paused: boolean;
287
+ queue: any[];
288
+ getAudioContext: memoize_one.MemoizedFn<() => any>;
289
+ pause(): void;
290
+ push(utterance: any): void;
291
+ resume(): void;
292
+ get speaking(): boolean;
293
+ startConsumer(): Promise<void>;
294
+ stop(): void;
295
+ }
296
+
269
297
  declare class SpeechSynthesisEvent {
270
298
  constructor(type: any);
271
299
  }
@@ -319,7 +347,7 @@ declare function _default(options: any): {
319
347
  SpeechSynthesisUtterance?: never;
320
348
  } | {
321
349
  speechSynthesis: {
322
- queue: AudioContextQueue;
350
+ queue: _default$1;
323
351
  cancel(): void;
324
352
  getVoices(): any[];
325
353
  onvoiceschanged: any;