Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web-speech-cognitive-services

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-speech-cognitive-services - npm Package Compare versions

Comparing version 8.0.0-main.d9ef940 to 8.0.0

290

dist/web-speech-cognitive-services.d.ts

@@ -1,123 +0,3 @@

import * as memoize_one from 'memoize-one';
import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
declare class SpeechSynthesisUtterance {
constructor(text: any);
_lang: any;
_pitch: number;
_rate: number;
_voice: any;
_volume: number;
text: any;
set onboundary(value: any);
get onboundary(): any;
set onend(value: any);
get onend(): any;
set onerror(value: any);
get onerror(): any;
set onmark(value: any);
get onmark(): any;
set onpause(value: any);
get onpause(): any;
set onresume(value: any);
get onresume(): any;
set onstart(value: any);
get onstart(): any;
set lang(value: any);
get lang(): any;
set pitch(value: number);
get pitch(): number;
set rate(value: number);
get rate(): number;
set voice(value: any);
get voice(): any;
set volume(value: number);
get volume(): number;
preload({ deploymentId, fetchCredentials, outputFormat }: {
deploymentId: any;
fetchCredentials: any;
outputFormat: any;
}): void;
arrayBufferPromise: Promise<ArrayBuffer> | undefined;
play(audioContext: any): Promise<void>;
_playingSource: any;
stop(): void;
}
declare class SpeechSynthesisEvent {
constructor(type: any);
}
declare class _default$2 {
constructor(audioContext: any);
audioContext: any;
pause(): void;
resume(): void;
start(queue: any): Promise<void>;
playingUtterance: any;
stop(): void;
}
declare class _default$1 {
constructor({ audioContext, ponyfill }: {
audioContext: any;
ponyfill: any;
});
consumer: _default$2 | null;
paused: boolean;
queue: any[];
getAudioContext: memoize_one.MemoizedFn<() => any>;
pause(): void;
push(utterance: any): void;
resume(): void;
get speaking(): boolean;
startConsumer(): Promise<void>;
stop(): void;
}
type Credentials = Readonly<({
authorizationToken: string;
subscriptionKey?: undefined;
} | {
authorizationToken?: undefined;
subscriptionKey: string;
}) & ({
customVoiceHostname?: undefined;
region: string;
speechRecognitionHostname?: undefined;
speechSynthesisHostname?: undefined;
} | {
customVoiceHostname: string;
region?: undefined;
speechRecognitionHostname: string;
speechSynthesisHostname: string;
})>;
type PatchOptionsInit = {
audioConfig: AudioConfig;
credentials?: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
enableTelemetry: boolean;
looseEvent?: boolean | undefined;
looseEvents?: boolean | undefined;
referenceGrammars?: readonly string[] | undefined;
region?: string | undefined;
speechRecognitionEndpointId: string;
textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
} & ({
authorizationToken: string;
subscriptionKey?: undefined;
} | {
authorizationToken?: undefined;
subscriptionKey: string;
});
declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {};
declare class SpeechGrammarList {
#private;
constructor();
addFromString(): void;
get phrases(): readonly string[];
set phrases(value: readonly string[]);
}
type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';

@@ -212,2 +92,105 @@ type SpeechRecognitionErrorEventInit = {

interface W3CSpeechGrammar {
src: string;
weight: number;
}
interface W3CSpeechGrammarList {
readonly length: number;
addFromString(string: string, weight?: number): void;
addFromURI(src: string, weight?: number): void;
item(index: number): W3CSpeechGrammar;
[index: number]: W3CSpeechGrammar;
}
declare class SpeechGrammarList implements W3CSpeechGrammarList {
#private;
constructor();
addFromString(): void;
addFromURI(): void;
item(): W3CSpeechGrammar;
get length(): number;
[index: number]: {
src: string;
weight: number;
};
get phrases(): readonly string[];
set phrases(value: readonly string[]);
}
type Credentials = Readonly<({
authorizationToken: string;
subscriptionKey?: undefined;
} | {
authorizationToken?: undefined;
subscriptionKey: string;
}) & ({
customVoiceHostname?: undefined;
region: string;
speechRecognitionHostname?: undefined;
speechSynthesisHostname?: undefined;
} | {
customVoiceHostname: string;
region?: undefined;
speechRecognitionHostname: string;
speechSynthesisHostname: string;
})>;
type PatchOptionsInit = {
audioConfig: AudioConfig;
credentials?: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
enableTelemetry: boolean;
looseEvent?: boolean | undefined;
looseEvents?: boolean | undefined;
referenceGrammars?: readonly string[] | undefined;
region?: string | undefined;
speechRecognitionEndpointId: string;
textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
} & ({
authorizationToken: string;
subscriptionKey?: undefined;
} | {
authorizationToken?: undefined;
subscriptionKey: string;
});
declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
SpeechGrammarList: typeof SpeechGrammarList;
SpeechRecognition: {
new (): {
"__#8@#continuous": boolean;
"__#8@#eventListenerMap": SpeechRecognitionEventListenerMap;
"__#8@#grammars": SpeechGrammarList;
"__#8@#interimResults": boolean;
"__#8@#lang": string;
"__#8@#maxAlternatives": number;
emitCognitiveServices<T extends {
type: string;
}>(type: string, event: T): void;
continuous: boolean;
grammars: SpeechGrammarList;
interimResults: boolean;
maxAlternatives: number;
lang: string;
get onaudioend(): ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined;
set onaudioend(value: ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined);
onaudiostart: ((event: SpeechRecognitionEvent<"audiostart">) => void) | undefined;
oncognitiveservices: ((event: SpeechRecognitionEvent<"cognitiveservices">) => void) | undefined;
onend: ((event: SpeechRecognitionEvent<"end">) => void) | undefined;
onerror: ((event: SpeechRecognitionErrorEvent) => void) | undefined;
onresult: ((event: SpeechRecognitionEvent<"result">) => void) | undefined;
onsoundend: ((event: SpeechRecognitionEvent<"soundend">) => void) | undefined;
onsoundstart: ((event: SpeechRecognitionEvent<"soundstart">) => void) | undefined;
onspeechend: ((event: SpeechRecognitionEvent<"speechend">) => void) | undefined;
onspeechstart: ((event: SpeechRecognitionEvent<"speechstart">) => void) | undefined;
onstart: ((event: SpeechRecognitionEvent<"start">) => void) | undefined;
abort: (() => void) | undefined;
stop: (() => void) | undefined;
start(): void;
_startOnce(): Promise<void>;
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
dispatchEvent(event: Event): boolean;
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
};
};
SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
};
type CreateSpeechRecognitionPonyfillFromRecognizerInit = {

@@ -272,2 +255,49 @@ createRecognizer: (lang: string) => Promise<SpeechRecognizer>;

declare class SpeechSynthesisEvent {
constructor(type: any);
}
declare class SpeechSynthesisUtterance {
constructor(text: any);
_lang: any;
_pitch: number;
_rate: number;
_voice: any;
_volume: number;
text: any;
set onboundary(value: any);
get onboundary(): any;
set onend(value: any);
get onend(): any;
set onerror(value: any);
get onerror(): any;
set onmark(value: any);
get onmark(): any;
set onpause(value: any);
get onpause(): any;
set onresume(value: any);
get onresume(): any;
set onstart(value: any);
get onstart(): any;
set lang(value: any);
get lang(): any;
set pitch(value: number);
get pitch(): number;
set rate(value: number);
get rate(): number;
set voice(value: any);
get voice(): any;
set volume(value: number);
get volume(): number;
preload({ deploymentId, fetchCredentials, outputFormat }: {
deploymentId: any;
fetchCredentials: any;
outputFormat: any;
}): void;
arrayBufferPromise: Promise<ArrayBuffer> | undefined;
play(audioContext: any): Promise<void>;
_playingSource: any;
stop(): void;
}
declare function _default(options: any): {

@@ -299,22 +329,4 @@ speechSynthesis?: never;

declare function createSpeechServicesPonyfill(options?: {}, ...args: any[]): {
speechSynthesis?: never;
SpeechSynthesisEvent?: never;
SpeechSynthesisUtterance?: never;
} | {
speechSynthesis: {
queue: _default$1;
cancel(): void;
getVoices(): any[];
onvoiceschanged: any;
pause(): void;
resume(): void;
speak(utterance: any): Promise<any>;
readonly speaking: boolean;
updateVoices(): Promise<void>;
};
SpeechSynthesisEvent: typeof SpeechSynthesisEvent;
SpeechSynthesisUtterance: typeof SpeechSynthesisUtterance;
};
declare function createSpeechServicesPonyfill(options?: any): any;
export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default as createSpeechSynthesisPonyfill, fetchAuthorizationToken };

@@ -33,3 +33,3 @@ "use strict";

__export(src_exports, {
createSpeechRecognitionPonyfill: () => SpeechToText_default,
createSpeechRecognitionPonyfill: () => createSpeechRecognitionPonyfill,
createSpeechRecognitionPonyfillFromRecognizer: () => createSpeechRecognitionPonyfillFromRecognizer,

@@ -365,2 +365,11 @@ createSpeechServicesPonyfill: () => createSpeechServicesPonyfill,

}
addFromURI() {
throw new Error("JSGF is not supported");
}
item() {
throw new Error("JSGF is not supported");
}
get length() {
throw new Error("JSGF is not supported");
}
#phrases;

@@ -827,6 +836,5 @@ get phrases() {

if (!audioConfig && (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia)) {
console.warn(
"web-speech-cognitive-services: This browser does not support WebRTC and it will not work with Cognitive Services Speech Services."
throw new Error(
"web-speech-cognitive-services: This browser does not support Media Capture and Streams API and it will not work with Cognitive Services Speech Services."
);
return {};
}

@@ -864,5 +872,2 @@ const createRecognizer = async (lang) => {

// src/SpeechServices/SpeechToText.ts
var SpeechToText_default = createSpeechRecognitionPonyfill;
// src/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js

@@ -1389,7 +1394,7 @@ var import_event_target_shim3 = require("event-target-shim");

// src/SpeechServices.js
function createSpeechServicesPonyfill(options = {}, ...args) {
// src/SpeechServices.ts
function createSpeechServicesPonyfill(options = {}) {
return {
...SpeechToText_default(options, ...args),
...TextToSpeech_default(options, ...args)
...createSpeechRecognitionPonyfill(options),
...TextToSpeech_default(options)
};

@@ -1399,3 +1404,3 @@ }

meta.setAttribute("name", "web-speech-cognitive-services");
meta.setAttribute("content", `version=${"8.0.0-main.d9ef940"}`);
meta.setAttribute("content", `version=${"8.0.0"}`);
document.head.appendChild(meta);

@@ -1402,0 +1407,0 @@ // Annotate the CommonJS export names for ESM import in node:

{
"name": "web-speech-cognitive-services",
"version": "8.0.0-main.d9ef940",
"version": "8.0.0",
"description": "Polyfill Web Speech API with Cognitive Services Speech-to-Text service",

@@ -103,3 +103,3 @@ "files": [

"simple-update-in": "^2.2.0",
"web-speech-cognitive-services": "^8.0.0-main.d9ef940"
"web-speech-cognitive-services": "^8.0.0"
},

@@ -106,0 +106,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc