web-speech-cognitive-services 8.0.0 → 8.0.1-main.7b3a347

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,4 +1,6 @@
1
1
  import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
2
+ import * as valibot from 'valibot';
3
+ import { InferOutput } from 'valibot';
2
4
 
3
5
  type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';
4
6
  type SpeechRecognitionErrorEventInit = {
@@ -115,40 +117,53 @@ declare class SpeechGrammarList implements W3CSpeechGrammarList {
115
117
  set phrases(value: readonly string[]);
116
118
  }
117
119
 
118
- type Credentials = Readonly<({
120
+ declare const credentialsSchema: valibot.SchemaWithPipe<[valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
121
+ readonly authorizationToken: valibot.StringSchema<undefined>;
122
+ readonly subscriptionKey: valibot.OptionalSchema<valibot.UndefinedSchema<"\"subscriptionKey\" must be unset when \"authorizationToken\" is set.">, never>;
123
+ }, undefined>, valibot.ObjectSchema<{
124
+ readonly authorizationToken: valibot.OptionalSchema<valibot.UndefinedSchema<"\"authorizationToken\" must be unset when \"subscriptionKey\" is set.">, never>;
125
+ readonly subscriptionKey: valibot.StringSchema<undefined>;
126
+ }, 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 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>;
131
+ }, 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>;
134
+ readonly speechRecognitionHostname: valibot.StringSchema<undefined>;
135
+ readonly speechSynthesisHostname: valibot.StringSchema<undefined>;
136
+ }, undefined>], "The object must either have either \"region\" or \"*Hostname\" set, but not both.">], undefined>, valibot.ReadonlyAction<({
119
137
  authorizationToken: string;
120
138
  subscriptionKey?: undefined;
121
139
  } | {
122
- authorizationToken?: undefined;
123
140
  subscriptionKey: string;
141
+ authorizationToken?: undefined;
124
142
  }) & ({
125
- customVoiceHostname?: undefined;
126
143
  region: string;
144
+ customVoiceHostname?: undefined;
127
145
  speechRecognitionHostname?: undefined;
128
146
  speechSynthesisHostname?: undefined;
129
147
  } | {
130
- customVoiceHostname: string;
131
- region?: undefined;
132
148
  speechRecognitionHostname: string;
133
149
  speechSynthesisHostname: string;
134
- })>;
150
+ customVoiceHostname?: string | undefined;
151
+ region?: undefined;
152
+ })>]>;
153
+
154
+ type Credentials = InferOutput<typeof credentialsSchema>;
155
+
135
156
  type PatchOptionsInit = {
136
- audioConfig: AudioConfig;
137
- credentials?: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
138
- enableTelemetry: boolean;
157
+ audioConfig?: AudioConfig | undefined;
158
+ credentials: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
159
+ enableTelemetry?: boolean | undefined;
160
+ initialSilenceTimeout?: number | undefined;
139
161
  looseEvent?: boolean | undefined;
140
162
  looseEvents?: boolean | undefined;
141
163
  referenceGrammars?: readonly string[] | undefined;
142
- region?: string | undefined;
143
- speechRecognitionEndpointId: string;
144
- textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
145
- } & ({
146
- authorizationToken: string;
147
- subscriptionKey?: undefined;
148
- } | {
149
- authorizationToken?: undefined;
150
- subscriptionKey: string;
151
- });
164
+ speechRecognitionEndpointId?: string | undefined;
165
+ textNormalization?: 'display' | 'itn' | 'lexical' | 'maskeditn' | undefined;
166
+ };
152
167
 
153
168
  declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
154
169
  SpeechGrammarList: typeof SpeechGrammarList;
@@ -194,7 +209,7 @@ declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
194
209
 
195
210
  type CreateSpeechRecognitionPonyfillFromRecognizerInit = {
196
211
  createRecognizer: (lang: string) => Promise<SpeechRecognizer>;
197
- enableTelemetry: boolean;
212
+ enableTelemetry: boolean | undefined;
198
213
  looseEvents: boolean;
199
214
  referenceGrammars?: readonly string[] | undefined;
200
215
  textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
@@ -1,4 +1,6 @@
1
1
  import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
2
+ import * as valibot from 'valibot';
3
+ import { InferOutput } from 'valibot';
2
4
 
3
5
  type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';
4
6
  type SpeechRecognitionErrorEventInit = {
@@ -115,40 +117,53 @@ declare class SpeechGrammarList implements W3CSpeechGrammarList {
115
117
  set phrases(value: readonly string[]);
116
118
  }
117
119
 
118
- type Credentials = Readonly<({
120
+ declare const credentialsSchema: valibot.SchemaWithPipe<[valibot.IntersectSchema<[valibot.UnionSchema<[valibot.ObjectSchema<{
121
+ readonly authorizationToken: valibot.StringSchema<undefined>;
122
+ readonly subscriptionKey: valibot.OptionalSchema<valibot.UndefinedSchema<"\"subscriptionKey\" must be unset when \"authorizationToken\" is set.">, never>;
123
+ }, undefined>, valibot.ObjectSchema<{
124
+ readonly authorizationToken: valibot.OptionalSchema<valibot.UndefinedSchema<"\"authorizationToken\" must be unset when \"subscriptionKey\" is set.">, never>;
125
+ readonly subscriptionKey: valibot.StringSchema<undefined>;
126
+ }, 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 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>;
131
+ }, 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>;
134
+ readonly speechRecognitionHostname: valibot.StringSchema<undefined>;
135
+ readonly speechSynthesisHostname: valibot.StringSchema<undefined>;
136
+ }, undefined>], "The object must either have either \"region\" or \"*Hostname\" set, but not both.">], undefined>, valibot.ReadonlyAction<({
119
137
  authorizationToken: string;
120
138
  subscriptionKey?: undefined;
121
139
  } | {
122
- authorizationToken?: undefined;
123
140
  subscriptionKey: string;
141
+ authorizationToken?: undefined;
124
142
  }) & ({
125
- customVoiceHostname?: undefined;
126
143
  region: string;
144
+ customVoiceHostname?: undefined;
127
145
  speechRecognitionHostname?: undefined;
128
146
  speechSynthesisHostname?: undefined;
129
147
  } | {
130
- customVoiceHostname: string;
131
- region?: undefined;
132
148
  speechRecognitionHostname: string;
133
149
  speechSynthesisHostname: string;
134
- })>;
150
+ customVoiceHostname?: string | undefined;
151
+ region?: undefined;
152
+ })>]>;
153
+
154
+ type Credentials = InferOutput<typeof credentialsSchema>;
155
+
135
156
  type PatchOptionsInit = {
136
- audioConfig: AudioConfig;
137
- credentials?: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
138
- enableTelemetry: boolean;
157
+ audioConfig?: AudioConfig | undefined;
158
+ credentials: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
159
+ enableTelemetry?: boolean | undefined;
160
+ initialSilenceTimeout?: number | undefined;
139
161
  looseEvent?: boolean | undefined;
140
162
  looseEvents?: boolean | undefined;
141
163
  referenceGrammars?: readonly string[] | undefined;
142
- region?: string | undefined;
143
- speechRecognitionEndpointId: string;
144
- textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
145
- } & ({
146
- authorizationToken: string;
147
- subscriptionKey?: undefined;
148
- } | {
149
- authorizationToken?: undefined;
150
- subscriptionKey: string;
151
- });
164
+ speechRecognitionEndpointId?: string | undefined;
165
+ textNormalization?: 'display' | 'itn' | 'lexical' | 'maskeditn' | undefined;
166
+ };
152
167
 
153
168
  declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
154
169
  SpeechGrammarList: typeof SpeechGrammarList;
@@ -194,7 +209,7 @@ declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
194
209
 
195
210
  type CreateSpeechRecognitionPonyfillFromRecognizerInit = {
196
211
  createRecognizer: (lang: string) => Promise<SpeechRecognizer>;
197
- enableTelemetry: boolean;
212
+ enableTelemetry: boolean | undefined;
198
213
  looseEvents: boolean;
199
214
  referenceGrammars?: readonly string[] | undefined;
200
215
  textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';