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
153
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 2.1.1-master.9469382 to 2.1.1-master.0f7758b

6

CHANGELOG.md

@@ -8,3 +8,9 @@ # Changelog

## [Unreleased]
### Added
- Speech Synthesis: Will async fetch speech token instead of throwing exception
### Changed
- Use `babel-runtime` and `babel-plugin-tranform-runtime`, in favor of `babel-polyfill`
- Better error handling on `null` token
## [2.1.0] - 2018-07-09

@@ -11,0 +17,0 @@ ### Added

2

lib/index.js

@@ -8,4 +8,2 @@ 'use strict';

require('babel-polyfill');
var _SpeechGrammarList = require('./recognition/SpeechGrammarList');

@@ -12,0 +10,0 @@

@@ -7,4 +7,14 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _simpleUpdateIn = require('simple-update-in');

@@ -16,9 +26,5 @@

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _class = function () {
function _class() {
_classCallCheck(this, _class);
(0, _classCallCheck3.default)(this, _class);

@@ -29,3 +35,3 @@ this._referenceGrammar = null;

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: 'addFromString',

@@ -46,3 +52,3 @@ value: function addFromString() {

var groups = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
return [].concat(_toConsumableArray(groups), [{
return [].concat((0, _toConsumableArray3.default)(groups), [{
Type: 'Generic',

@@ -57,3 +63,3 @@ Hints: { ReferenceGrammar: referenceGrammar }

var groups = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
return [].concat(_toConsumableArray(groups), [{
return [].concat((0, _toConsumableArray3.default)(groups), [{
Type: 'Generic',

@@ -94,3 +100,2 @@ Items: words.map(function (word) {

}]);
return _class;

@@ -97,0 +102,0 @@ }();

@@ -7,6 +7,34 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _regenerator = require('babel-runtime/regenerator');
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _stringify = require('babel-runtime/core-js/json/stringify');
var _stringify2 = _interopRequireDefault(_stringify);
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _microsoftSpeechBrowserSdk = require('microsoft-speech-browser-sdk');

@@ -28,12 +56,6 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function buildSpeechResult(transcript, confidence, isFinal) {

@@ -51,3 +73,3 @@ var result = [{ confidence: confidence, transcript: transcript }];

_classCallCheck(this, _class);
(0, _classCallCheck3.default)(this, _class);

@@ -78,3 +100,3 @@ this._lang = '';

var deviceModel = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'web-speech-cognitive-services';
var deviceVersion = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "2.1.1-master.9469382";
var deviceVersion = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "1.0.0";

@@ -84,7 +106,11 @@ var config = new CognitiveSpeech.RecognizerConfig(new CognitiveSpeech.SpeechConfig(new CognitiveSpeech.Context(new CognitiveSpeech.OS(osPlatform, osName, osVersion), new CognitiveSpeech.Device(deviceManufacturer, deviceModel, deviceVersion))), mode, lang, CognitiveSpeech.SpeechResultFormat.Detailed);

var fetchToken = function fetchToken() {
var sink = new CognitiveSpeech.Sink();
try {
var _sink = new CognitiveSpeech.Sink();
_this.speechToken.authorized.then(sink.Resolve, sink.Reject);
_this.speechToken.authorized.then(_sink.Resolve, _sink.Reject);
return new CognitiveSpeech.Promise(sink);
return new CognitiveSpeech.Promise(_sink);
} catch (err) {
sink.Reject(err.message);
}
};

@@ -96,3 +122,3 @@

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: 'abort',

@@ -114,3 +140,3 @@ value: function abort() {

listener && listener.call(this, _extends({}, event, { type: name }));
listener && listener.call(this, (0, _extends3.default)({}, event, { type: name }));
}

@@ -126,15 +152,15 @@ }, {

value: function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var recognizer, _toPromise, eventListener, promises, speechContext, error, listeningStarted, recognitionStarted, gotFirstHypothesis, speechHypothesis, speechDetailedPhrase, recognitionResult;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
recognizer = this.recognizer = this.createRecognizer(this.lang, this.osPlatform || window.navigator.userAgent, this.osName || window.navigator.appName, this.osVersion || window.navigator.appVersion, this.deviceManufacturer || 'web-speech-cognitive-services', this.deviceModel || 'web-speech-cognitive-services', this.deviceVersion || "2.1.1-master.9469382");
_toPromise = toPromise(), eventListener = _toPromise.eventListener, promises = _objectWithoutProperties(_toPromise, ['eventListener']);
recognizer = this.recognizer = this.createRecognizer(this.lang, this.osPlatform || window.navigator.userAgent, this.osName || window.navigator.appName, this.osVersion || window.navigator.appVersion, this.deviceManufacturer || 'web-speech-cognitive-services', this.deviceModel || 'web-speech-cognitive-services', this.deviceVersion || "1.0.0");
_toPromise = toPromise(), eventListener = _toPromise.eventListener, promises = (0, _objectWithoutProperties3.default)(_toPromise, ['eventListener']);
speechContext = this.grammars && this.grammars.createSpeechContext();
recognizer.Recognize(eventListener, speechContext && JSON.stringify(speechContext));
recognizer.Recognize(eventListener, speechContext && (0, _stringify2.default)(speechContext));
this._aborted = false;

@@ -148,3 +174,3 @@

_context.next = 10;
return Promise.race([promises.listeningStarted, promises.recognitionEnded]);
return _promise2.default.race([promises.listeningStarted, promises.recognitionEnded]);

@@ -176,3 +202,3 @@ case 10:

_context.next = 20;
return Promise.race([promises.recognitionStarted, promises.recognitionEnded]);
return _promise2.default.race([promises.recognitionStarted, promises.recognitionEnded]);

@@ -204,3 +230,3 @@ case 20:

_context.next = 29;
return Promise.race([promises.getSpeechHypothesisPromise(), promises.speechEndDetected]);
return _promise2.default.race([promises.getSpeechHypothesisPromise(), promises.speechEndDetected]);

@@ -258,3 +284,3 @@ case 29:

_context.next = 46;
return Promise.race([promises.speechDetailedPhrase, promises.recognitionEnded]);
return _promise2.default.race([promises.speechDetailedPhrase, promises.recognitionEnded]);

@@ -360,3 +386,2 @@ case 46:

}]);
return _class;

@@ -363,0 +388,0 @@ }();

@@ -7,20 +7,32 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _regenerator = require('babel-runtime/regenerator');
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var _regenerator2 = _interopRequireDefault(_regenerator);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _class = function () {
function _class() {
_classCallCheck(this, _class);
(0, _classCallCheck3.default)(this, _class);
}
_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: 'start',
value: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(queue) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(queue) {
var audioContextClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.AudioContext || window.webkitAudioContext;
var utterance;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -97,3 +109,2 @@ switch (_context.prev = _context.next) {

}]);
return _class;

@@ -100,0 +111,0 @@ }();

@@ -7,4 +7,18 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _AudioContextConsumer = require('./AudioContextConsumer');

@@ -16,12 +30,7 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _class = function () {
function _class() {
var audioContextClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.AudioContext || window.webkitAudioContext;
(0, _classCallCheck3.default)(this, _class);
_classCallCheck(this, _class);
this.audioContextClass = audioContextClass;

@@ -32,7 +41,7 @@ this.consumer = null;

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: 'startConsumer',
value: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -82,3 +91,2 @@ switch (_context.prev = _context.next) {

}]);
return _class;

@@ -85,0 +93,0 @@ }();

@@ -7,2 +7,10 @@ 'use strict';

var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _buildSSML = require('./buildSSML');

@@ -14,4 +22,2 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var DEFAULT_LANGUAGE = 'en-US';

@@ -22,3 +28,3 @@ var DEFAULT_VOICE = 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)';

exports.default = function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref) {
var _ref$lang = _ref.lang,

@@ -35,3 +41,3 @@ lang = _ref$lang === undefined ? DEFAULT_LANGUAGE : _ref$lang,

var ssml, res;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -38,0 +44,0 @@ switch (_context.prev = _context.next) {

@@ -7,4 +7,22 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _AudioContextQueue = require('./AudioContextQueue');

@@ -24,6 +42,2 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// Supported output format can be found at https://docs.microsoft.com/en-us/azure/cognitive-services/Speech/API-Reference-REST/BingVoiceOutput#Subscription

@@ -34,3 +48,3 @@ var DEFAULT_OUTPUT_FORMAT = 'audio-16khz-128kbitrate-mono-mp3';

function SpeechSynthesis() {
_classCallCheck(this, SpeechSynthesis);
(0, _classCallCheck3.default)(this, SpeechSynthesis);

@@ -42,3 +56,3 @@ this.onvoiceschanged = null;

_createClass(SpeechSynthesis, [{
(0, _createClass3.default)(SpeechSynthesis, [{
key: 'cancel',

@@ -56,6 +70,7 @@ value: function cancel() {

value: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(utterance) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(utterance) {
var _this = this;
return regeneratorRuntime.wrap(function _callee$(_context) {
var speechToken;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -80,15 +95,12 @@ switch (_context.prev = _context.next) {

case 4:
if (this.speechToken.value) {
_context.next = 6;
break;
}
_context.next = 6;
return this.speechToken.authorized;
throw new Error('must wait for token to be authorized prior speak()');
case 6:
return _context.abrupt('return', new Promise(function (resolve, reject) {
speechToken = _context.sent;
return _context.abrupt('return', new _promise2.default(function (resolve, reject) {
utterance.addEventListener('end', resolve);
utterance.addEventListener('error', reject);
utterance.outputFormat = _this.outputFormat;
utterance.speechToken = _this.speechToken.value;
utterance.speechToken = speechToken;
utterance.preload();

@@ -99,3 +111,3 @@

case 7:
case 8:
case 'end':

@@ -115,3 +127,2 @@ return _context.stop();

}]);
return SpeechSynthesis;

@@ -118,0 +129,0 @@ }();

@@ -7,4 +7,34 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _domEventEmitter = require('../util/domEventEmitter');

@@ -28,12 +58,4 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function asyncDecodeAudioData(audioContext, arrayBuffer) {
return new Promise(function (resolve, reject) {
return new _promise2.default(function (resolve, reject) {
var promise = audioContext.decodeAudioData(arrayBuffer, resolve, reject);

@@ -49,6 +71,6 @@

return new Promise(function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
return new _promise2.default(function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(resolve, reject) {
var audioContextClosed, unsubscribe;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -107,8 +129,8 @@ switch (_context.prev = _context.next) {

var _class = function (_DOMEventEmitter) {
_inherits(_class, _DOMEventEmitter);
(0, _inherits3.default)(_class, _DOMEventEmitter);
function _class(text) {
_classCallCheck(this, _class);
(0, _classCallCheck3.default)(this, _class);
var _this2 = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, ['boundary', 'end', 'error', 'mark', 'pause', 'resume', 'start']));
var _this2 = (0, _possibleConstructorReturn3.default)(this, (_class.__proto__ || (0, _getPrototypeOf2.default)(_class)).call(this, ['boundary', 'end', 'error', 'mark', 'pause', 'resume', 'start']));

@@ -133,7 +155,7 @@ _this2._lang = null;

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: 'preload',
value: function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {

@@ -173,5 +195,5 @@ switch (_context2.prev = _context2.next) {

value: function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(audioContext) {
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(audioContext) {
var source, audioBuffer;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {

@@ -272,3 +294,2 @@ switch (_context3.prev = _context3.next) {

}]);
return _class;

@@ -275,0 +296,0 @@ }(_domEventEmitter2.default);

@@ -7,6 +7,12 @@ "use strict";

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require("babel-runtime/helpers/createClass");
var _createClass3 = _interopRequireDefault(_createClass2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _class = function () {

@@ -17,5 +23,4 @@ function _class(_ref) {

voiceURI = _ref.voiceURI;
(0, _classCallCheck3.default)(this, _class);
_classCallCheck(this, _class);
this._lang = lang;

@@ -26,3 +31,3 @@ this._name = name;

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: "default",

@@ -53,3 +58,2 @@ get: function get() {

}]);
return _class;

@@ -56,0 +60,0 @@ }();

@@ -7,4 +7,10 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _events = require('events');

@@ -16,4 +22,2 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _class = function () {

@@ -24,5 +28,4 @@ function _class() {

var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
(0, _classCallCheck3.default)(this, _class);
_classCallCheck(this, _class);
this._events = new _events2.default();

@@ -39,3 +42,3 @@

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: 'addEventListener',

@@ -58,3 +61,2 @@ value: function addEventListener(name, listener) {

}]);
return _class;

@@ -61,0 +63,0 @@ }();

@@ -7,10 +7,18 @@ 'use strict';

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var TOKEN_URL = 'https://api.cognitive.microsoft.com/sts/v1.0/issueToken';
exports.default = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(subscriptionKey) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(subscriptionKey) {
var res;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -17,0 +25,0 @@ switch (_context.prev = _context.next) {

@@ -7,4 +7,18 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _exchangeToken = require('./exchangeToken');

@@ -16,6 +30,2 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// Token expiration is hardcoded at 10 minutes

@@ -28,3 +38,3 @@ // https://docs.microsoft.com/en-us/azure/cognitive-services/Speech/how-to/how-to-authentication?tabs=Powershell#use-an-authorization-token

function _class(subscriptionKey) {
_classCallCheck(this, _class);
(0, _classCallCheck3.default)(this, _class);

@@ -36,9 +46,9 @@ this.subscriptionKey = subscriptionKey;

_createClass(_class, [{
(0, _createClass3.default)(_class, [{
key: '_renew',
value: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var _this = this;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -76,3 +86,2 @@ switch (_context.prev = _context.next) {

}]);
return _class;

@@ -79,0 +88,0 @@ }();

{
"name": "web-speech-cognitive-services",
"version": "2.1.1-master.9469382",
"version": "2.1.1-master.0f7758b",
"description": "Polyfill Web Speech API with Cognitive Services Speech-to-Text service",

@@ -30,3 +30,3 @@ "keywords": [

"scripts": {
"bootstrap": "lerna bootstrap --hoist",
"bootstrap": "lerna bootstrap",
"build": "lerna run build",

@@ -46,29 +46,15 @@ "test": "lerna run test"

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-env": "^2.4.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-version-transform": "^1.0.0",
"babel-polyfill": "^6.26.0",
"babel-preset-stage-3": "^6.24.1",
"classnames": "^2.2.6",
"glamor": "^2.20.40",
"jest": "^22.4.4",
"lerna": "^2.11.0",
"microsoft-speech-browser-sdk": "^0.0.12",
"react": "^16.4.1",
"react-dictate-button": "^1.1.2",
"react-dom": "^16.4.1",
"react-scripts": "1.1.4",
"rimraf": "^2.6.2"
"lerna": "^3.1.4"
},
"dependencies": {
"event-as-promise": "^1.0.3",
"memoize-one": "^4.0.0"
"events": "^3.0.0",
"memoize-one": "^4.0.0",
"react-say": "0.0.1-master.ca079e3",
"simple-update-in": "^1.2.0"
},
"peerDependencies": {
"babel-polyfill": "^6.26.0",
"microsoft-speech-browser-sdk": "^0.0.12",
"react": "^16.4.1"
"react": "^16.4.2"
}
}

@@ -161,2 +161,8 @@ # web-speech-cognitive-services

## To-do
* Add `babel-runtime`, `microsoft-speech-browser-sdk`, and `simple-update-in`
## Plan
* General

@@ -163,0 +169,0 @@ * [x] Unified [token exchange mechanism](packages/component/src/util/SubscriptionKey.js)

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 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 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

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