From 045017cab67553e859d9a05a1686ac1d9bbf8be3 Mon Sep 17 00:00:00 2001 From: Danilo Lima Date: Fri, 10 Nov 2023 21:51:30 -0300 Subject: [PATCH 1/3] chore: it adds ingored file to gitignore (#18) * chore(gitignore): it adds ingored file to gitignore From 7a2eb6f00524c80333b748367131306a737b7d44 Mon Sep 17 00:00:00 2001 From: DaniloLima122 Date: Fri, 10 Nov 2023 22:14:11 -0300 Subject: [PATCH 2/3] fix(voiceaction): it fixes voiceAction function params types definition fix #16 --- src/features/voiceAction/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/features/voiceAction/index.js b/src/features/voiceAction/index.js index 53499fe..8c4bb19 100644 --- a/src/features/voiceAction/index.js +++ b/src/features/voiceAction/index.js @@ -13,15 +13,16 @@ import { debounce } from "../../utils/debounce"; * @param {Object} commandParams - Configuration parameters for VoiceCommand. * @param {boolean} [commandParams.continuous=true] - Specifies if the listening should be continuous. * @param {string} [commandParams.lang='pt-BR'] - Specifies the language for recognize the command. - * @param {Function} [commandParams.onError] - Callback function to be called when command recognition throw an error. - * @param {Map} [commandParams.commandsMapping] - Map of the respective commands and callback functions. - * @param {Array} [commandParams.middlewares] - Array of middleware functions to apply to the recognized command before invoke respective callback function. + * @param {function} [commandParams.onError] - Callback function to be called when command recognition throw an error. + * @param {Map} [commandParams.commandsMapping] - Map of the respective commands and callback functions. + * @param {Array} [commandParams.middlewares] - Array of middleware functions to apply to the recognized command before invoke respective callback function. * @param {number} [commandParams.DEBOUNCE_DELAY=50] - The delay (in milliseconds) to debounce voice commands. * @param {boolean} [commandParams.keepListening=true] - Whether to keep listening for voice commands after each execution. * @throws {VoiceCommandNotFound} - Throws an error in case respective voice command it's not founded. * @throws {InvalidVoiceCommandCallbackType} Throws an error if the command callback type is invalid. * @throws {Error} - Throws an error if the browser does not support the Speech Recognition API. - * @returns {{ listenVoiceCommand: Function, stopListening: Function }} + * @returns {{ + * listenVoiceCommand: (onStart: function, onEnd: function) => void, stopListening: function }} */ export function VoiceCommand(commandParams) { @@ -81,9 +82,8 @@ export function VoiceCommand(commandParams) { * * @throws {Error} - Throws an error if the browser does not support the Speech Recognition API. * @throws {InvalidVoiceCommandCallbackType} Throws an error if the command callback type is invalid. - * @param {Object} options - Configuration options for voice recognition. - * @param {Function} [options.onEnd=() => {}] - A callback function to be executed when listening ends. - * @param {Function} [options.onStart=() => {}] - A callback function to be executed when listening starts. + * @param {Function} [onStart=() => {}] - A callback function to be executed when listening starts. + * @param {Function} [onEnd=() => {}] - A callback function to be executed when listening ends. * @returns {void} */ function listenVoiceCommand( From eba2b9c073e2cf4345f3fc86fb41ddf41b20fd42 Mon Sep 17 00:00:00 2001 From: Danilo Lima Date: Wed, 15 Nov 2023 16:33:07 -0300 Subject: [PATCH 3/3] docs: it adds documentation (#20) * docs: it adds documentation This commit adds github README documentation, including contribution guildelines and library docs, besides npm documentation for library on npm page --- .gitignore | 3 +- CONTRIBUTING.md | 46 +++++ README.md | 262 +++++++++++++++++++++++++++- jsdoc.config.json | 15 -- package-lock.json | 195 +-------------------- package.json | 4 +- src/features/recognition/index.js | 6 +- src/features/transcription/index.js | 6 +- src/features/voiceSyntesis/index.js | 1 + 9 files changed, 320 insertions(+), 218 deletions(-) create mode 100644 CONTRIBUTING.md delete mode 100644 jsdoc.config.json diff --git a/.gitignore b/.gitignore index 99c513e..80199c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ lib/ -index.html +bin/ +index.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5fb19b8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# Contributing Guidelines + +## Welcome! + +Thank you for considering contributing to this project! Whether you are fixing a bug, adding a new feature, or improving documentation, your contributions are appreciated. + +Before you start contributing, please take a moment to read the following guidelines. + +## How to Contribute + +1. Fork the repository. +2. Create a new branch: `git checkout -b feature/your-feature` or `git checkout -b bugfix/your-bugfix`. +3. Make your changes and commit them, by running: `npm run commit`. +4. Push to the branch: `git push origin feature/your-feature`. +5. Submit a pull request. + +## Reporting Issues + +Before submitting an issue: + +- Check the [existing issues](https://github.com/danilolmc/zaity/issues) to see if the problem has already been reported. +- Ensure you are using the latest version of the project. + +When submitting an issue, please include: + +- A detailed description of the issue. +- Steps to reproduce the issue. +- Expected behavior. +- Screenshots or code snippets if applicable. + +## Pull Requests + +When submitting a pull request: + +- Update documentation if needed. +- Update the `CHANGELOG.md` if applicable. + +## Documentation + +Improve the documentation or add new documentation for your changes. + +## Licensing + +By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE). + +Thank you for your contributions! diff --git a/README.md b/README.md index 1d36b6e..caeba88 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,266 @@
-

Zaity - Your web media accessibility library

+
+ +## Zaity + +![npm](https://img.shields.io/npm/v/zaity-kit) [![Build](https://github.com/danilolmc/zaity/actions/workflows/build_release.yml/badge.svg)](https://github.com/danilolmc/zaity/actions/workflows/build_release.yml) + +Zaity is a javascript library for creating voice based web user interfaces + +The package contains a set of tools that helps to build voice based features in your web application, this way extending the tool set for +users with needs for accessibility resources interact with your application web experience, as its main tool this library includes: Realtime Voice Recognition, Voice Synthesizing, Voice based task execution and Audio/Video Transcription modules. + +## Instalation + +```javascript +npm install zaity-kit +``` + +## Usage + +#### Voice Recognition + +This module provides functionality to recognize and transcribe voice in realtime in the browser + +```javascript +import { VoiceSynthesizer } from "zaity-kit/browser"; + +const voiceSynthesizer = VoiceSynthesizer({ + lang: "en-US", + onError: (error) => { + console.error("Voice synthesis error:", error); + }, + middlewares: [ + (text) => { + // Apply custom middleware right before synthesis result for customize it + return text.replace("Hi", "Hello"); + }, + ], +}); +voiceSynthesizer.speak("Hi, world!"); +``` + +#### Voice Command + +This module provides functionality to give voice commands to the browser, which can be bonded to a javascript code. + +```javascript +import { VoiceCommand } from "zaity-kit/browser"; + +const voiceCommand = VoiceCommand({ + continuous: true, + lang: "en-US", + onError: (error) => { + console.error("Voice command recognition error:", error); + }, + commandsMapping: new Map([ + ["open", () => console.log("Opening something")], + ["close", () => console.log("Closing something")], + ]), + middlewares: [ + (command) => { + // Apply custom middleware before calling bonded command + return command.toLowerCase(); + }, + ], + DEBOUNCE_DELAY: 50, + keepListening: true, +}); + +voiceCommand.listenVoiceCommand( + () => console.log("Listening started..."), + () => console.log("Listening stopped...") +); +``` + +#### Voice Synthesizer + +This module provides functionality to synthesizing voice from the browser. + +```javascript +import { VoiceSynthesizer } from "zaity-kit/browser"; + +const voiceSynthesizer = VoiceSynthesizer({ + lang: "en-US", + onError: (error) => { + console.error("Voice synthesis error:", error); + }, + middlewares: [ + (text) => { + // Apply a custom middleware right before synthesis result is returned + return text.toUpperCase(); + }, + ], +}); + +voiceSynthesizer.speak("Hello, world!"); +``` + +#### Voice Transcriber + +This module provides the funcionality to transcribe audio/video files, powered by AWS, in a nodeJS environment. + +```javascript +const transcriber = VoiceBatchTranscriber({ + // Provide your AWS credentials here +}); + +transcriber.setJobParams({ + // Provide transcription job parameters here + TranscriptionJobName: "yourtranscriptionjob", + LanguageCode: "en-US", + Media: { + MediaFileUri: "s3://your-bucket/your-audio-file.mp3", + }, + OutputBucketName: "yourtranscriptionbucket", +}); + +transcriber.transcribe( + (success) => console.log("Transcription successful:", success), + (error) => console.error("Transcription error:", error) +); +``` + +## API Reference + +#### Voice Recognition + +**VoiceRecognition(params)**: Creates a new instance of the VoiceRecognition module. + +- **params**: Configuration parameters for VoiceRecognition. + + - continuous (boolean) - Specifies if the recognition should be continuous. + - interimResults (boolean) - Specifies if interim results should be provided. + - lang (string) - Specifies the language for recognition, default **pt-BR**. + - DEBOUNCE_DELAY (number) - Specifies the debounce delay for updates. + - keepListening (boolean) - Specifies if recognition should keep listening after each end event. + - onEnd (callback: Function) - Callback function to be called when recognition ends. + - onStart (callback: Function) - Callback function to be called when recognition starts. + - onError (callback: Function) - Callback function to be called when recognition throw an error. + - middlewares (Array) - Array of middleware functions to apply to the transcript. + +**Exceptions** + +- Error - Throws an error if the browser or Speech Recognition API is not supported. +- InvalidRecognitionCallbackType - Throws an error if the callback operation type is invalid. + +**Methods** + +- **listen(callbackOperation: Function | HTMLElement)**: Start listening user audio input. + + ```javascript + voiceRecognition.listen((result) => console.log(result)); + ``` + +- **stopListening()**: Stop speech listening of user voice input. + + ```javascript + voiceSynthesizer.stopListening(); + ``` + +#### Voice Command + +**VoiceCommand(commandParams)**: Creates a new instance of the VoiceCommand module. + +- **commandParams**: Configuration parameters for VoiceCommand. + + - continuous (boolean, optional, default: true): Specifies if the listening should be continuous. + - lang (string, optional, default: 'pt-BR'): Specifies the language for recognizing the command. + - onError (function, optional): Callback function to be called when command recognition throws an error. + - commandsMapping (Map, optional): Map of the respective commands and callback functions. + - middlewares (Array, optional): Array of middleware functions to apply to the recognized command before invoking the respective callback function. + - DEBOUNCE_DELAY (number, optional, default: 50): The delay (in milliseconds) to debounce voice commands. + - keepListening (boolean, optional, default: true): Whether to keep listening for voice commands after each execution. + +**Exceptions** + +- VoiceCommandNotFound: Throws an error in case the respective voice command is not found. +- InvalidVoiceCommandCallbackType: Throws an error if the command callback type is invalid. +- Error: Throws an error if the browser does not support the Speech Recognition API. + +**Methods** + +- listenVoiceCommand(onStart: function, onEnd: function): Starts listening for voice commands. + + ```javascript + voiceCommand.listenVoiceCommand( + () => console.log("Listening started..."), + () => console.log("Listening stopped...") + ); + ``` + +- **stopListening()**: Stops listening for voice commands. + + ```javascript + voiceSynthesizer.stopListening(); + ``` + +#### VoiceSynthesizer + +**VoiceSynthesizer(synthesisParams)**: Creates a new instance of the VoiceSynthesizer module. + +- **synthesisParams**: Configuration object with parameters for VoiceSynthesizer. + + - lang (string): Specifies the output voice language, default is **pt-BR**. + - onError (callback: Function): Optional callback function to be called when voice synthesis encounters an error. + - middlewares (Array): Optional array of middleware functions to apply over the content which will be synthesized into voice. + +**Exceptions** + +- Error - Throws an error if the browser does not support the Speech Synthesis interface. +- InvalidLangCode - Throws an error when a voice for the specified language is not valid. + +**Methods** + +- **speak(text: string)**: Function returned by VoiceSynthesizer constructor to synthesize and speak the provided text. + + ```javascript + voiceSynthesizer.speak("Hello, world!"); + ``` + +- **pauseSpeaking()**: Function returned by VoiceSynthesizer constructor to pause the currently ongoing voice synthesis. + + ```javascript + voiceSynthesizer.pauseSpeaking(); + ``` + +- **resumeSpeaking()**: Function returned by VoiceSynthesizer constructor to resume the paused voice synthesis. + + ```javascript + voiceSynthesizer.resumeSpeaking(); + ``` + +#### Voice Transcriber + +**VoiceBatchTranscriber(credentials)**: Creates a new instance of the VoiceTranscription module. + +- credentials (TranscribeClientConfig): The authentication credentials for the transcription service. + +**Methods** + +- **setJobParams(params: StartTranscriptionJobCommandInput)**: Sets transcription job params. + + ```javascript + transcriber.setJobParams({ + Media: { + MediaFileUri: "s3://your-bucket/your-audio-file.mp3", + } + }), + ``` + +- **transcribe(success: Function, error: Function)**: Starts the transcribe job. + + ```javascript + voiceSynthesizer.transcribe( + () => console.log("It succeed"), + () => console.log("Oops, something goes wrong!") + ); + ``` diff --git a/jsdoc.config.json b/jsdoc.config.json deleted file mode 100644 index 770d850..0000000 --- a/jsdoc.config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "source": { - "include": ["src"], - "includePattern": ".+\\.js$" - }, - "plugins": [], - "templates": { - "cleverLinks": false, - "monospaceLinks": false - }, - "opts": { - "destination": "docs", - "recurse": true - } -} diff --git a/package-lock.json b/package-lock.json index 9c0295b..913020e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "zaity", - "version": "1.0.6", + "name": "zaity-kit", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "zaity", - "version": "1.0.6", + "name": "zaity-kit", + "version": "1.0.0", "hasInstallScript": true, "license": "ISC", "devDependencies": { @@ -27,7 +27,6 @@ "dts-bundle-webpack": "^1.0.2", "dts-webpack-plugin": "^0.0.9", "husky": "^8.0.0", - "jsdoc": "^4.0.2", "npm-dts-webpack-plugin": "^1.3.12", "semantic-release": "^22.0.5", "socket.io-client": "^4.7.2", @@ -3022,18 +3021,6 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, - "node_modules/@jsdoc/salty": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.5.tgz", - "integrity": "sha512-TfRP53RqunNe2HBobVBJ0VLhK1HbfvBYeTC1ahnN64PWvyYyGebmMiPkuwvD9fpw2ZbkoPb8Q7mwy0aR8Z9rvw==", - "dev": true, - "dependencies": { - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=v12.0.0" - } - }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", @@ -4893,28 +4880,6 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, - "node_modules/@types/linkify-it": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", - "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", - "dev": true - }, - "node_modules/@types/markdown-it": { - "version": "12.2.3", - "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", - "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", - "dev": true, - "dependencies": { - "@types/linkify-it": "*", - "@types/mdurl": "*" - } - }, - "node_modules/@types/mdurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", - "dev": true - }, "node_modules/@types/mime": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", @@ -6072,12 +6037,6 @@ "readable-stream": "^3.4.0" } }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -6436,18 +6395,6 @@ "cdl": "bin/cdl.js" } }, - "node_modules/catharsis": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", - "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", - "dev": true, - "dependencies": { - "lodash": "^4.17.15" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/center-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", @@ -8539,15 +8486,6 @@ "node": ">=10.13.0" } }, - "node_modules/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", - "dev": true, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/env-ci": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-10.0.0.tgz", @@ -10933,53 +10871,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/js2xmlparser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", - "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", - "dev": true, - "dependencies": { - "xmlcreate": "^2.0.4" - } - }, - "node_modules/jsdoc": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.2.tgz", - "integrity": "sha512-e8cIg2z62InH7azBBi3EsSEqrKx+nUtAS5bBcYTSpZFA+vhNPyhv8PTFZ0WsjOPDj04/dOLlm08EDcQJDqaGQg==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.20.15", - "@jsdoc/salty": "^0.2.1", - "@types/markdown-it": "^12.2.3", - "bluebird": "^3.7.2", - "catharsis": "^0.9.0", - "escape-string-regexp": "^2.0.0", - "js2xmlparser": "^4.0.2", - "klaw": "^3.0.0", - "markdown-it": "^12.3.2", - "markdown-it-anchor": "^8.4.1", - "marked": "^4.0.10", - "mkdirp": "^1.0.4", - "requizzle": "^0.2.3", - "strip-json-comments": "^3.1.0", - "underscore": "~1.13.2" - }, - "bin": { - "jsdoc": "jsdoc.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/jsdoc/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -11080,15 +10971,6 @@ "node": ">=0.10.0" } }, - "node_modules/klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.9" - } - }, "node_modules/kuler": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", @@ -11141,15 +11023,6 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", - "dev": true, - "dependencies": { - "uc.micro": "^1.0.1" - } - }, "node_modules/load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -11451,37 +11324,12 @@ "node": ">=0.10.0" } }, - "node_modules/markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, - "node_modules/markdown-it-anchor": { - "version": "8.6.7", - "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", - "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", - "dev": true, - "peerDependencies": { - "@types/markdown-it": "*", - "markdown-it": "*" - } - }, "node_modules/marked": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "dev": true, + "peer": true, "bin": { "marked": "bin/marked.js" }, @@ -11559,12 +11407,6 @@ "safe-buffer": "^5.1.2" } }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", - "dev": true - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -17026,15 +16868,6 @@ "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "dev": true }, - "node_modules/requizzle": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", - "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", - "dev": true, - "dependencies": { - "lodash": "^4.17.21" - } - }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -19317,12 +19150,6 @@ "node": ">=14.17" } }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true - }, "node_modules/uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -19390,12 +19217,6 @@ "dev": true, "optional": true }, - "node_modules/underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", - "dev": true - }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -20555,12 +20376,6 @@ } } }, - "node_modules/xmlcreate": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", - "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", - "dev": true - }, "node_modules/xmlhttprequest-ssl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", diff --git a/package.json b/package.json index dfc2bba..8a4e784 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "commit": "git-cz", "prepare": "husky install", "postinstall": "npx husky install", - "docs": "jsdoc -c jsdoc.config.json", "types": "tsc", "ci": "npm pkg delete scripts.prepare & npm ci --omit=dev", "semantic-release": "semantic-release" @@ -72,7 +71,6 @@ "dts-bundle-webpack": "^1.0.2", "dts-webpack-plugin": "^0.0.9", "husky": "^8.0.0", - "jsdoc": "^4.0.2", "npm-dts-webpack-plugin": "^1.3.12", "semantic-release": "^22.0.5", "socket.io-client": "^4.7.2", @@ -91,4 +89,4 @@ "type": "git", "url": "https://github.com/danilolmc/zaity.git" } -} \ No newline at end of file +} diff --git a/src/features/recognition/index.js b/src/features/recognition/index.js index d0c7674..325180b 100644 --- a/src/features/recognition/index.js +++ b/src/features/recognition/index.js @@ -8,8 +8,8 @@ import { debounce } from "../../utils/debounce"; /** * Module for capturing voice and generating captions using the Speech Recognition API. * - * @module VoiceCaptions - * @param {Object} params - Configuration parameters for VoiceCaptions. + * @module VoiceRecognition + * @param {Object} params - Configuration parameters for VoiceRecognition. * @param {boolean} [params.continuous=true] - Specifies if the recognition should be continuous. * @param {boolean} [params.interimResults=false] - Specifies if interim results should be provided. * @param {string} [params.lang='pt-BR'] - Specifies the language for recognition. @@ -26,7 +26,7 @@ import { debounce } from "../../utils/debounce"; * stopListening: () => void * }} */ -export function VoiceCaptions(params) { +export function VoiceRecognition(params) { let recognitionInstance; let { diff --git a/src/features/transcription/index.js b/src/features/transcription/index.js index edf2020..35aa6fa 100644 --- a/src/features/transcription/index.js +++ b/src/features/transcription/index.js @@ -5,10 +5,10 @@ import { StartTranscriptionJobCommand, TranscribeClient } from "@aws-sdk/client- * @param {import("@aws-sdk/client-transcribe").TranscribeClientConfig} credentials - The authentication credentials for the transcription service. * @returns {{ * setJobParams: (params: import("@aws-sdk/client-transcribe").StartTranscriptionJobCommandInput) => void, - * transcribe(success: Function, error: Function): void + * transcribe(success: function, error: function): void * }} */ -export function Transcriber(credentials) { +export function VoiceBatchTranscriber(credentials) { let transribeClient; let jobParams; @@ -63,4 +63,4 @@ export function Transcriber(credentials) { }; } -export default Transcriber; +export default VoiceBatchTranscriber; diff --git a/src/features/voiceSyntesis/index.js b/src/features/voiceSyntesis/index.js index 6e81427..2dcaaf4 100644 --- a/src/features/voiceSyntesis/index.js +++ b/src/features/voiceSyntesis/index.js @@ -12,6 +12,7 @@ import { CONSTANTS_SYNTHESIS } from "../../utils/constantsValues"; * @param {Function} [syntesisParams.onError] - Callback function to be called when command recognition throw an error. * @param {Array} [syntesisParams.middlewares] - Array of middleware functions to apply over the content wich will be syntetized a voice. * @throws {Error} - Throws an error if the browser does not support the Speech Synthesis interface. + * @throws {InvalidLangCode} Throws an error when a voice for the specified language is not valid. * @returns {{ * speak: (text: string) => void, * pauseSpeaking: () => void,