web-speech-cognitive-services 7.1.4-master.151bc9b → 8.0.0-main.15b930d
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.
- package/dist/web-speech-cognitive-services.d.mts +329 -0
- package/dist/web-speech-cognitive-services.d.ts +329 -0
- package/dist/web-speech-cognitive-services.development.js +25746 -0
- package/dist/web-speech-cognitive-services.development.js.map +1 -0
- package/dist/web-speech-cognitive-services.js +1409 -0
- package/dist/web-speech-cognitive-services.js.map +1 -0
- package/dist/web-speech-cognitive-services.mjs +1374 -0
- package/dist/web-speech-cognitive-services.mjs.map +1 -0
- package/dist/web-speech-cognitive-services.production.min.js +31 -0
- package/dist/web-speech-cognitive-services.production.min.js.map +1 -0
- package/package.json +67 -47
- package/CHANGELOG.md +0 -372
- package/lib/BingSpeech/SpeechToText/SpeechGrammarList.js +0 -94
- package/lib/BingSpeech/SpeechToText/SpeechGrammarList.js.map +0 -1
- package/lib/BingSpeech/SpeechToText/createSpeechRecognitionPonyfill.js +0 -483
- package/lib/BingSpeech/SpeechToText/createSpeechRecognitionPonyfill.js.map +0 -1
- package/lib/BingSpeech/SpeechToText.js +0 -14
- package/lib/BingSpeech/SpeechToText.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/AudioContextConsumer.js +0 -122
- package/lib/BingSpeech/TextToSpeech/AudioContextConsumer.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/AudioContextQueue.js +0 -104
- package/lib/BingSpeech/TextToSpeech/AudioContextQueue.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js +0 -264
- package/lib/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js +0 -61
- package/lib/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/buildSSML.js +0 -32
- package/lib/BingSpeech/TextToSpeech/buildSSML.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/createSpeechSynthesisPonyfill.js +0 -220
- package/lib/BingSpeech/TextToSpeech/createSpeechSynthesisPonyfill.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/fetchSpeechData.js +0 -74
- package/lib/BingSpeech/TextToSpeech/fetchSpeechData.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/fetchVoices.js +0 -335
- package/lib/BingSpeech/TextToSpeech/fetchVoices.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/isSSML.js +0 -13
- package/lib/BingSpeech/TextToSpeech/isSSML.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech/subscribeEvent.js +0 -14
- package/lib/BingSpeech/TextToSpeech/subscribeEvent.js.map +0 -1
- package/lib/BingSpeech/TextToSpeech.js +0 -14
- package/lib/BingSpeech/TextToSpeech.js.map +0 -1
- package/lib/BingSpeech/Util/DOMEventEmitter.js +0 -61
- package/lib/BingSpeech/Util/DOMEventEmitter.js.map +0 -1
- package/lib/BingSpeech/Util/createFetchTokenUsingSubscriptionKey.js +0 -41
- package/lib/BingSpeech/Util/createFetchTokenUsingSubscriptionKey.js.map +0 -1
- package/lib/BingSpeech/fetchAuthorizationToken.js +0 -57
- package/lib/BingSpeech/fetchAuthorizationToken.js.map +0 -1
- package/lib/BingSpeech/index.js +0 -84
- package/lib/BingSpeech/index.js.map +0 -1
- package/lib/SpeechServices/SpeechSDK.js +0 -19
- package/lib/SpeechServices/SpeechSDK.js.map +0 -1
- package/lib/SpeechServices/SpeechToText/SpeechGrammarList.js +0 -45
- package/lib/SpeechServices/SpeechToText/SpeechGrammarList.js.map +0 -1
- package/lib/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js +0 -56
- package/lib/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js.map +0 -1
- package/lib/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js +0 -984
- package/lib/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js.map +0 -1
- package/lib/SpeechServices/SpeechToText.js +0 -24
- package/lib/SpeechServices/SpeechToText.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/AudioContextConsumer.js +0 -92
- package/lib/SpeechServices/TextToSpeech/AudioContextConsumer.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/AudioContextQueue.js +0 -111
- package/lib/SpeechServices/TextToSpeech/AudioContextQueue.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js +0 -40
- package/lib/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js +0 -283
- package/lib/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js +0 -63
- package/lib/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/buildSSML.js +0 -32
- package/lib/SpeechServices/TextToSpeech/buildSSML.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js +0 -282
- package/lib/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/fetchCustomVoices.js +0 -110
- package/lib/SpeechServices/TextToSpeech/fetchCustomVoices.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/fetchSpeechData.js +0 -127
- package/lib/SpeechServices/TextToSpeech/fetchSpeechData.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/fetchVoices.js +0 -87
- package/lib/SpeechServices/TextToSpeech/fetchVoices.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/isSSML.js +0 -13
- package/lib/SpeechServices/TextToSpeech/isSSML.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech/subscribeEvent.js +0 -14
- package/lib/SpeechServices/TextToSpeech/subscribeEvent.js.map +0 -1
- package/lib/SpeechServices/TextToSpeech.js +0 -14
- package/lib/SpeechServices/TextToSpeech.js.map +0 -1
- package/lib/SpeechServices/fetchAuthorizationToken.js +0 -58
- package/lib/SpeechServices/fetchAuthorizationToken.js.map +0 -1
- package/lib/SpeechServices/patchOptions.js +0 -213
- package/lib/SpeechServices/patchOptions.js.map +0 -1
- package/lib/SpeechServices/resolveFunctionOrReturnValue.js +0 -11
- package/lib/SpeechServices/resolveFunctionOrReturnValue.js.map +0 -1
- package/lib/SpeechServices.js +0 -73
- package/lib/SpeechServices.js.map +0 -1
- package/lib/Util/arrayToMap.js +0 -28
- package/lib/Util/arrayToMap.js.map +0 -1
- package/lib/Util/createPromiseQueue.js +0 -40
- package/lib/Util/createPromiseQueue.js.map +0 -1
- package/lib/index.js +0 -14
- package/lib/index.js.map +0 -1
- package/umd/web-speech-cognitive-services.development.js +0 -4740
- package/umd/web-speech-cognitive-services.production.min.js +0 -2
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = isSSML;
|
|
7
|
-
var SPEAK_TAG_PATTERN = /^[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*<speak([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]|\/?>)/;
|
|
8
|
-
var XML_PROLOG_PATTERN = /^[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*<\?xml[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
9
|
-
|
|
10
|
-
function isSSML(text) {
|
|
11
|
-
return SPEAK_TAG_PATTERN.test(text) || XML_PROLOG_PATTERN.test(text);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=isSSML.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isSSML.js","names":["SPEAK_TAG_PATTERN","XML_PROLOG_PATTERN","isSSML","text","test"],"sources":["../../../src/SpeechServices/TextToSpeech/isSSML.js"],"sourcesContent":["const SPEAK_TAG_PATTERN = /^\\s*<speak(\\s|\\/?>)/u;\nconst XML_PROLOG_PATTERN = /^\\s*<\\?xml\\s/u;\n\nexport default function isSSML(text) {\n return SPEAK_TAG_PATTERN.test(text) || XML_PROLOG_PATTERN.test(text);\n}\n"],"mappings":";;;;;;AAAA,IAAMA,iBAAiB,GAAG,uJAA1B;AACA,IAAMC,kBAAkB,GAAG,gJAA3B;;AAEe,SAASC,MAAT,CAAgBC,IAAhB,EAAsB;EACnC,OAAOH,iBAAiB,CAACI,IAAlB,CAAuBD,IAAvB,KAAgCF,kBAAkB,CAACG,IAAnB,CAAwBD,IAAxB,CAAvC;AACD"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = subscribeEvent;
|
|
7
|
-
|
|
8
|
-
function subscribeEvent(target, name, handler) {
|
|
9
|
-
target.addEventListener(name, handler);
|
|
10
|
-
return function () {
|
|
11
|
-
return target.removeEventListener(name, handler);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=subscribeEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscribeEvent.js","names":["subscribeEvent","target","name","handler","addEventListener","removeEventListener"],"sources":["../../../src/SpeechServices/TextToSpeech/subscribeEvent.js"],"sourcesContent":["export default function subscribeEvent(target, name, handler) {\n target.addEventListener(name, handler);\n\n return () => target.removeEventListener(name, handler);\n}\n"],"mappings":";;;;;;;AAAe,SAASA,cAAT,CAAwBC,MAAxB,EAAgCC,IAAhC,EAAsCC,OAAtC,EAA+C;EAC5DF,MAAM,CAACG,gBAAP,CAAwBF,IAAxB,EAA8BC,OAA9B;EAEA,OAAO;IAAA,OAAMF,MAAM,CAACI,mBAAP,CAA2BH,IAA3B,EAAiCC,OAAjC,CAAN;EAAA,CAAP;AACD"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _createSpeechSynthesisPonyfill = _interopRequireDefault(require("./TextToSpeech/createSpeechSynthesisPonyfill"));
|
|
11
|
-
|
|
12
|
-
var _default = _createSpeechSynthesisPonyfill.default;
|
|
13
|
-
exports.default = _default;
|
|
14
|
-
//# sourceMappingURL=TextToSpeech.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextToSpeech.js","names":["createSpeechSynthesisPonyfill"],"sources":["../../src/SpeechServices/TextToSpeech.js"],"sourcesContent":["import createSpeechSynthesisPonyfill from './TextToSpeech/createSpeechSynthesisPonyfill';\n\nexport default createSpeechSynthesisPonyfill;\n"],"mappings":";;;;;;;;;AAAA;;eAEeA,sC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = _default;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var TOKEN_URL_TEMPLATE = 'https://{region}.api.cognitive.microsoft.com/sts/v1.0/issueToken';
|
|
15
|
-
|
|
16
|
-
function _default(_x) {
|
|
17
|
-
return _ref2.apply(this, arguments);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _ref2() {
|
|
21
|
-
_ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
22
|
-
var region, subscriptionKey, res;
|
|
23
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
24
|
-
while (1) {
|
|
25
|
-
switch (_context.prev = _context.next) {
|
|
26
|
-
case 0:
|
|
27
|
-
region = _ref.region, subscriptionKey = _ref.subscriptionKey;
|
|
28
|
-
_context.next = 3;
|
|
29
|
-
return fetch(TOKEN_URL_TEMPLATE.replace(/\{region\}/, region), {
|
|
30
|
-
headers: {
|
|
31
|
-
'Ocp-Apim-Subscription-Key': subscriptionKey
|
|
32
|
-
},
|
|
33
|
-
method: 'POST'
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
case 3:
|
|
37
|
-
res = _context.sent;
|
|
38
|
-
|
|
39
|
-
if (res.ok) {
|
|
40
|
-
_context.next = 6;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
throw new Error("Failed to fetch authorization token, server returned ".concat(res.status));
|
|
45
|
-
|
|
46
|
-
case 6:
|
|
47
|
-
return _context.abrupt("return", res.text());
|
|
48
|
-
|
|
49
|
-
case 7:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, _callee);
|
|
55
|
-
}));
|
|
56
|
-
return _ref2.apply(this, arguments);
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=fetchAuthorizationToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAuthorizationToken.js","names":["TOKEN_URL_TEMPLATE","region","subscriptionKey","fetch","replace","headers","method","res","ok","Error","status","text"],"sources":["../../src/SpeechServices/fetchAuthorizationToken.js"],"sourcesContent":["const TOKEN_URL_TEMPLATE = 'https://{region}.api.cognitive.microsoft.com/sts/v1.0/issueToken';\n\nexport default async function ({ region, subscriptionKey }) {\n const res = await fetch(\n TOKEN_URL_TEMPLATE.replace(/\\{region\\}/u, region),\n {\n headers: {\n 'Ocp-Apim-Subscription-Key': subscriptionKey\n },\n method: 'POST'\n }\n );\n\n if (!res.ok) {\n throw new Error(`Failed to fetch authorization token, server returned ${ res.status }`);\n }\n\n return res.text();\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAMA,kBAAkB,GAAG,kEAA3B;;;;;;;kFAEe;IAAA;IAAA;MAAA;QAAA;UAAA;YAAkBC,MAAlB,QAAkBA,MAAlB,EAA0BC,eAA1B,QAA0BA,eAA1B;YAAA;YAAA,OACKC,KAAK,CACrBH,kBAAkB,CAACI,OAAnB,CAA2B,YAA3B,EAA0CH,MAA1C,CADqB,EAErB;cACEI,OAAO,EAAE;gBACP,6BAA6BH;cADtB,CADX;cAIEI,MAAM,EAAE;YAJV,CAFqB,CADV;;UAAA;YACPC,GADO;;YAAA,IAWRA,GAAG,CAACC,EAXI;cAAA;cAAA;YAAA;;YAAA,MAYL,IAAIC,KAAJ,gEAAmEF,GAAG,CAACG,MAAvE,EAZK;;UAAA;YAAA,iCAeNH,GAAG,CAACI,IAAJ,EAfM;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = patchOptions;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
-
|
|
18
|
-
var _resolveFunctionOrReturnValue = _interopRequireDefault(require("./resolveFunctionOrReturnValue"));
|
|
19
|
-
|
|
20
|
-
var _excluded = ["authorizationToken", "credentials", "looseEvent", "looseEvents", "region", "subscriptionKey"];
|
|
21
|
-
|
|
22
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
-
|
|
26
|
-
var shouldWarnOnSubscriptionKey = true;
|
|
27
|
-
|
|
28
|
-
function patchOptions() {
|
|
29
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
|
-
|
|
31
|
-
var authorizationToken = _ref.authorizationToken,
|
|
32
|
-
credentials = _ref.credentials,
|
|
33
|
-
looseEvent = _ref.looseEvent,
|
|
34
|
-
looseEvents = _ref.looseEvents,
|
|
35
|
-
_ref$region = _ref.region,
|
|
36
|
-
region = _ref$region === void 0 ? 'westus' : _ref$region,
|
|
37
|
-
subscriptionKey = _ref.subscriptionKey,
|
|
38
|
-
otherOptions = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
39
|
-
|
|
40
|
-
if (typeof looseEvent !== 'undefined') {
|
|
41
|
-
console.warn('web-speech-cognitive-services: The option "looseEvent" should be named as "looseEvents".');
|
|
42
|
-
looseEvents = looseEvent;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!credentials) {
|
|
46
|
-
if (!authorizationToken && !subscriptionKey) {
|
|
47
|
-
throw new Error('web-speech-cognitive-services: Credentials must be specified.');
|
|
48
|
-
} else {
|
|
49
|
-
console.warn('web-speech-cognitive-services: We are deprecating authorizationToken, region, and subscriptionKey. Please use credentials instead. The deprecated option will be removed on or after 2020-11-14.');
|
|
50
|
-
|
|
51
|
-
credentials = /*#__PURE__*/function () {
|
|
52
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
53
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
54
|
-
while (1) {
|
|
55
|
-
switch (_context.prev = _context.next) {
|
|
56
|
-
case 0:
|
|
57
|
-
if (!authorizationToken) {
|
|
58
|
-
_context.next = 8;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_context.next = 3;
|
|
63
|
-
return (0, _resolveFunctionOrReturnValue.default)(authorizationToken);
|
|
64
|
-
|
|
65
|
-
case 3:
|
|
66
|
-
_context.t1 = _context.sent;
|
|
67
|
-
_context.t2 = region;
|
|
68
|
-
_context.t0 = {
|
|
69
|
-
authorizationToken: _context.t1,
|
|
70
|
-
region: _context.t2
|
|
71
|
-
};
|
|
72
|
-
_context.next = 13;
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
case 8:
|
|
76
|
-
_context.t3 = region;
|
|
77
|
-
_context.next = 11;
|
|
78
|
-
return (0, _resolveFunctionOrReturnValue.default)(subscriptionKey);
|
|
79
|
-
|
|
80
|
-
case 11:
|
|
81
|
-
_context.t4 = _context.sent;
|
|
82
|
-
_context.t0 = {
|
|
83
|
-
region: _context.t3,
|
|
84
|
-
subscriptionKey: _context.t4
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
case 13:
|
|
88
|
-
return _context.abrupt("return", _context.t0);
|
|
89
|
-
|
|
90
|
-
case 14:
|
|
91
|
-
case "end":
|
|
92
|
-
return _context.stop();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, _callee);
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
return function credentials() {
|
|
99
|
-
return _ref2.apply(this, arguments);
|
|
100
|
-
};
|
|
101
|
-
}();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return _objectSpread(_objectSpread({}, otherOptions), {}, {
|
|
106
|
-
fetchCredentials: function () {
|
|
107
|
-
var _fetchCredentials = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
108
|
-
var _yield$resolveFunctio, authorizationToken, customVoiceHostname, region, speechRecognitionHostname, speechSynthesisHostname, subscriptionKey, resolvedCredentials;
|
|
109
|
-
|
|
110
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
111
|
-
while (1) {
|
|
112
|
-
switch (_context2.prev = _context2.next) {
|
|
113
|
-
case 0:
|
|
114
|
-
_context2.next = 2;
|
|
115
|
-
return (0, _resolveFunctionOrReturnValue.default)(credentials);
|
|
116
|
-
|
|
117
|
-
case 2:
|
|
118
|
-
_yield$resolveFunctio = _context2.sent;
|
|
119
|
-
authorizationToken = _yield$resolveFunctio.authorizationToken;
|
|
120
|
-
customVoiceHostname = _yield$resolveFunctio.customVoiceHostname;
|
|
121
|
-
region = _yield$resolveFunctio.region;
|
|
122
|
-
speechRecognitionHostname = _yield$resolveFunctio.speechRecognitionHostname;
|
|
123
|
-
speechSynthesisHostname = _yield$resolveFunctio.speechSynthesisHostname;
|
|
124
|
-
subscriptionKey = _yield$resolveFunctio.subscriptionKey;
|
|
125
|
-
|
|
126
|
-
if (!(!authorizationToken && !subscriptionKey || authorizationToken && subscriptionKey)) {
|
|
127
|
-
_context2.next = 13;
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
throw new Error('web-speech-cognitive-services: Either "authorizationToken" or "subscriptionKey" must be provided.');
|
|
132
|
-
|
|
133
|
-
case 13:
|
|
134
|
-
if (!(!region && !(speechRecognitionHostname && speechSynthesisHostname))) {
|
|
135
|
-
_context2.next = 17;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
throw new Error('web-speech-cognitive-services: Either "region" or "speechRecognitionHostname" and "speechSynthesisHostname" must be set.');
|
|
140
|
-
|
|
141
|
-
case 17:
|
|
142
|
-
if (!(region && (customVoiceHostname || speechRecognitionHostname || speechSynthesisHostname))) {
|
|
143
|
-
_context2.next = 21;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
throw new Error('web-speech-cognitive-services: Only either "region" or "customVoiceHostname", "speechRecognitionHostname" and "speechSynthesisHostname" can be set.');
|
|
148
|
-
|
|
149
|
-
case 21:
|
|
150
|
-
if (!authorizationToken) {
|
|
151
|
-
_context2.next = 26;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!(typeof authorizationToken !== 'string')) {
|
|
156
|
-
_context2.next = 24;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
throw new Error('web-speech-cognitive-services: "authorizationToken" must be a string.');
|
|
161
|
-
|
|
162
|
-
case 24:
|
|
163
|
-
_context2.next = 28;
|
|
164
|
-
break;
|
|
165
|
-
|
|
166
|
-
case 26:
|
|
167
|
-
if (!(typeof subscriptionKey !== 'string')) {
|
|
168
|
-
_context2.next = 28;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
throw new Error('web-speech-cognitive-services: "subscriptionKey" must be a string.');
|
|
173
|
-
|
|
174
|
-
case 28:
|
|
175
|
-
if (shouldWarnOnSubscriptionKey && subscriptionKey) {
|
|
176
|
-
console.warn('web-speech-cognitive-services: In production environment, subscription key should not be used, authorization token should be used instead.');
|
|
177
|
-
shouldWarnOnSubscriptionKey = false;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
resolvedCredentials = authorizationToken ? {
|
|
181
|
-
authorizationToken: authorizationToken
|
|
182
|
-
} : {
|
|
183
|
-
subscriptionKey: subscriptionKey
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
if (region) {
|
|
187
|
-
resolvedCredentials.region = region;
|
|
188
|
-
} else {
|
|
189
|
-
resolvedCredentials.customVoiceHostname = customVoiceHostname;
|
|
190
|
-
resolvedCredentials.speechRecognitionHostname = speechRecognitionHostname;
|
|
191
|
-
resolvedCredentials.speechSynthesisHostname = speechSynthesisHostname;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return _context2.abrupt("return", resolvedCredentials);
|
|
195
|
-
|
|
196
|
-
case 32:
|
|
197
|
-
case "end":
|
|
198
|
-
return _context2.stop();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, _callee2);
|
|
202
|
-
}));
|
|
203
|
-
|
|
204
|
-
function fetchCredentials() {
|
|
205
|
-
return _fetchCredentials.apply(this, arguments);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return fetchCredentials;
|
|
209
|
-
}(),
|
|
210
|
-
looseEvents: looseEvents
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
//# sourceMappingURL=patchOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patchOptions.js","names":["shouldWarnOnSubscriptionKey","patchOptions","authorizationToken","credentials","looseEvent","looseEvents","region","subscriptionKey","otherOptions","console","warn","Error","resolveFunctionOrReturnValue","fetchCredentials","customVoiceHostname","speechRecognitionHostname","speechSynthesisHostname","resolvedCredentials"],"sources":["../../src/SpeechServices/patchOptions.js"],"sourcesContent":["import resolveFunctionOrReturnValue from './resolveFunctionOrReturnValue';\n\nlet shouldWarnOnSubscriptionKey = true;\n\nexport default function patchOptions({\n authorizationToken,\n credentials,\n looseEvent,\n looseEvents,\n region = 'westus',\n subscriptionKey,\n ...otherOptions\n} = {}) {\n if (typeof looseEvent !== 'undefined') {\n console.warn('web-speech-cognitive-services: The option \"looseEvent\" should be named as \"looseEvents\".');\n\n looseEvents = looseEvent;\n }\n\n if (!credentials) {\n if (!authorizationToken && !subscriptionKey) {\n throw new Error('web-speech-cognitive-services: Credentials must be specified.');\n } else {\n console.warn(\n 'web-speech-cognitive-services: We are deprecating authorizationToken, region, and subscriptionKey. Please use credentials instead. The deprecated option will be removed on or after 2020-11-14.'\n );\n\n credentials = async () =>\n authorizationToken\n ? { authorizationToken: await resolveFunctionOrReturnValue(authorizationToken), region }\n : { region, subscriptionKey: await resolveFunctionOrReturnValue(subscriptionKey) };\n }\n }\n\n return {\n ...otherOptions,\n fetchCredentials: async () => {\n const {\n authorizationToken,\n customVoiceHostname,\n region,\n speechRecognitionHostname,\n speechSynthesisHostname,\n subscriptionKey\n } = await resolveFunctionOrReturnValue(credentials);\n\n if ((!authorizationToken && !subscriptionKey) || (authorizationToken && subscriptionKey)) {\n throw new Error(\n 'web-speech-cognitive-services: Either \"authorizationToken\" or \"subscriptionKey\" must be provided.'\n );\n } else if (!region && !(speechRecognitionHostname && speechSynthesisHostname)) {\n throw new Error(\n 'web-speech-cognitive-services: Either \"region\" or \"speechRecognitionHostname\" and \"speechSynthesisHostname\" must be set.'\n );\n } else if (region && (customVoiceHostname || speechRecognitionHostname || speechSynthesisHostname)) {\n throw new Error(\n 'web-speech-cognitive-services: Only either \"region\" or \"customVoiceHostname\", \"speechRecognitionHostname\" and \"speechSynthesisHostname\" can be set.'\n );\n } else if (authorizationToken) {\n if (typeof authorizationToken !== 'string') {\n throw new Error('web-speech-cognitive-services: \"authorizationToken\" must be a string.');\n }\n } else if (typeof subscriptionKey !== 'string') {\n throw new Error('web-speech-cognitive-services: \"subscriptionKey\" must be a string.');\n }\n\n if (shouldWarnOnSubscriptionKey && subscriptionKey) {\n console.warn(\n 'web-speech-cognitive-services: In production environment, subscription key should not be used, authorization token should be used instead.'\n );\n\n shouldWarnOnSubscriptionKey = false;\n }\n\n const resolvedCredentials = authorizationToken ? { authorizationToken } : { subscriptionKey };\n\n if (region) {\n resolvedCredentials.region = region;\n } else {\n resolvedCredentials.customVoiceHostname = customVoiceHostname;\n resolvedCredentials.speechRecognitionHostname = speechRecognitionHostname;\n resolvedCredentials.speechSynthesisHostname = speechSynthesisHostname;\n }\n\n return resolvedCredentials;\n },\n looseEvents\n };\n}\n"],"mappings":"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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = resolveFunctionOrReturnValue;
|
|
7
|
-
|
|
8
|
-
function resolveFunctionOrReturnValue(fnOrValue) {
|
|
9
|
-
return typeof fnOrValue === 'function' ? fnOrValue() : fnOrValue;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=resolveFunctionOrReturnValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveFunctionOrReturnValue.js","names":["resolveFunctionOrReturnValue","fnOrValue"],"sources":["../../src/SpeechServices/resolveFunctionOrReturnValue.js"],"sourcesContent":["export default function resolveFunctionOrReturnValue(fnOrValue) {\n return typeof fnOrValue === 'function' ? fnOrValue() : fnOrValue;\n}\n"],"mappings":";;;;;;;AAAe,SAASA,4BAAT,CAAsCC,SAAtC,EAAiD;EAC9D,OAAO,OAAOA,SAAP,KAAqB,UAArB,GAAkCA,SAAS,EAA3C,GAAgDA,SAAvD;AACD"}
|
package/lib/SpeechServices.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, "createSpeechRecognitionPonyfill", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _SpeechToText.default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "createSpeechRecognitionPonyfillFromRecognizer", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function get() {
|
|
19
|
-
return _SpeechToText.createSpeechRecognitionPonyfillFromRecognizer;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(exports, "createSpeechSynthesisPonyfill", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return _TextToSpeech.default;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
exports.default = createSpeechServicesPonyfill;
|
|
29
|
-
Object.defineProperty(exports, "fetchAuthorizationToken", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function get() {
|
|
32
|
-
return _fetchAuthorizationToken.default;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
37
|
-
|
|
38
|
-
var _SpeechToText = _interopRequireWildcard(require("./SpeechServices/SpeechToText"));
|
|
39
|
-
|
|
40
|
-
var _TextToSpeech = _interopRequireDefault(require("./SpeechServices/TextToSpeech"));
|
|
41
|
-
|
|
42
|
-
var _fetchAuthorizationToken = _interopRequireDefault(require("./SpeechServices/fetchAuthorizationToken"));
|
|
43
|
-
|
|
44
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
|
-
|
|
46
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
-
|
|
48
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
49
|
-
|
|
50
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
51
|
-
|
|
52
|
-
function createSpeechServicesPonyfill() {
|
|
53
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
54
|
-
|
|
55
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
56
|
-
args[_key - 1] = arguments[_key];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var ponyfill = _objectSpread(_objectSpread({}, _SpeechToText.default.apply(void 0, [options].concat(args))), _TextToSpeech.default.apply(void 0, [options].concat(args)));
|
|
60
|
-
|
|
61
|
-
return _objectSpread(_objectSpread({}, ponyfill), {}, {
|
|
62
|
-
then: function then(resolve) {
|
|
63
|
-
console.warn('web-speech-cognitive-services: This function no longer need to be called in an asynchronous fashion. Please update your code. We will remove this Promise.then function on or after 2020-08-10.');
|
|
64
|
-
resolve(ponyfill);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
var meta = document.createElement('meta');
|
|
70
|
-
meta.setAttribute('name', 'web-speech-cognitive-services');
|
|
71
|
-
meta.setAttribute('content', "version=".concat("7.1.4-master.151bc9b"));
|
|
72
|
-
document.head.appendChild(meta);
|
|
73
|
-
//# sourceMappingURL=SpeechServices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpeechServices.js","names":["createSpeechServicesPonyfill","options","args","ponyfill","createSpeechRecognitionPonyfill","createSpeechSynthesisPonyfill","then","resolve","console","warn","meta","document","createElement","setAttribute","head","appendChild"],"sources":["../src/SpeechServices.js"],"sourcesContent":["/* global process */\n\nimport createSpeechRecognitionPonyfill, {\n createSpeechRecognitionPonyfillFromRecognizer\n} from './SpeechServices/SpeechToText';\nimport createSpeechSynthesisPonyfill from './SpeechServices/TextToSpeech';\nimport fetchAuthorizationToken from './SpeechServices/fetchAuthorizationToken';\n\nexport default function createSpeechServicesPonyfill(options = {}, ...args) {\n const ponyfill = {\n ...createSpeechRecognitionPonyfill(options, ...args),\n ...createSpeechSynthesisPonyfill(options, ...args)\n };\n\n return {\n ...ponyfill,\n then: resolve => {\n console.warn(\n 'web-speech-cognitive-services: This function no longer need to be called in an asynchronous fashion. Please update your code. We will remove this Promise.then function on or after 2020-08-10.'\n );\n\n resolve(ponyfill);\n }\n };\n}\n\nexport {\n createSpeechRecognitionPonyfill,\n createSpeechRecognitionPonyfillFromRecognizer,\n createSpeechSynthesisPonyfill,\n fetchAuthorizationToken\n}\n\nconst meta = document.createElement('meta');\n\nmeta.setAttribute('name', 'web-speech-cognitive-services');\nmeta.setAttribute('content', `version=${ process.env.npm_package_version }`);\n\ndocument.head.appendChild(meta);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAGA;;AACA;;;;;;;;;;AAEe,SAASA,4BAAT,GAA6D;EAAA,IAAvBC,OAAuB,uEAAb,EAAa;;EAAA,kCAANC,IAAM;IAANA,IAAM;EAAA;;EAC1E,IAAMC,QAAQ,mCACTC,qBAAA,gBAAgCH,OAAhC,SAA4CC,IAA5C,EADS,GAETG,qBAAA,gBAA8BJ,OAA9B,SAA0CC,IAA1C,EAFS,CAAd;;EAKA,uCACKC,QADL;IAEEG,IAAI,EAAE,cAAAC,OAAO,EAAI;MACfC,OAAO,CAACC,IAAR,CACE,iMADF;MAIAF,OAAO,CAACJ,QAAD,CAAP;IACD;EARH;AAUD;;AASD,IAAMO,IAAI,GAAGC,QAAQ,CAACC,aAAT,CAAuB,MAAvB,CAAb;AAEAF,IAAI,CAACG,YAAL,CAAkB,MAAlB,EAA0B,+BAA1B;AACAH,IAAI,CAACG,YAAL,CAAkB,SAAlB;AAEAF,QAAQ,CAACG,IAAT,CAAcC,WAAd,CAA0BL,IAA1B"}
|
package/lib/Util/arrayToMap.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = _default;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
|
-
function _default(array, extras) {
|
|
17
|
-
var map = _objectSpread(_objectSpread(_objectSpread({}, [].reduce.call(array, function (map, value, index) {
|
|
18
|
-
map[index] = value;
|
|
19
|
-
return map;
|
|
20
|
-
}, {})), extras), {}, (0, _defineProperty2.default)({
|
|
21
|
-
length: array.length
|
|
22
|
-
}, Symbol.iterator, function () {
|
|
23
|
-
return [].slice.call(map)[Symbol.iterator]();
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
return map;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=arrayToMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrayToMap.js","names":["array","extras","map","reduce","call","value","index","length","Symbol","iterator","slice"],"sources":["../../src/Util/arrayToMap.js"],"sourcesContent":["export default function(array, extras) {\n const map = {\n ...[].reduce.call(\n array,\n (map, value, index) => {\n map[index] = value;\n\n return map;\n },\n {}\n ),\n ...extras,\n length: array.length,\n [Symbol.iterator]: () => [].slice.call(map)[Symbol.iterator]()\n };\n\n return map;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAe,kBAASA,KAAT,EAAgBC,MAAhB,EAAwB;EACrC,IAAMC,GAAG,iDACJ,GAAGC,MAAH,CAAUC,IAAV,CACDJ,KADC,EAED,UAACE,GAAD,EAAMG,KAAN,EAAaC,KAAb,EAAuB;IACrBJ,GAAG,CAACI,KAAD,CAAH,GAAaD,KAAb;IAEA,OAAOH,GAAP;EACD,CANA,EAOD,EAPC,CADI,GAUJD,MAVI;IAWPM,MAAM,EAAEP,KAAK,CAACO;EAXP,GAYNC,MAAM,CAACC,QAZD,EAYY;IAAA,OAAM,GAAGC,KAAH,CAASN,IAAT,CAAcF,GAAd,EAAmBM,MAAM,CAACC,QAA1B,GAAN;EAAA,CAZZ,EAAT;;EAeA,OAAOP,GAAP;AACD"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = _default;
|
|
9
|
-
|
|
10
|
-
var _pDeferEs = _interopRequireDefault(require("p-defer-es5"));
|
|
11
|
-
|
|
12
|
-
function _default() {
|
|
13
|
-
var shiftDeferred;
|
|
14
|
-
var queue = [];
|
|
15
|
-
|
|
16
|
-
var push = function push(value) {
|
|
17
|
-
if (shiftDeferred) {
|
|
18
|
-
var _shiftDeferred = shiftDeferred,
|
|
19
|
-
resolve = _shiftDeferred.resolve;
|
|
20
|
-
shiftDeferred = null;
|
|
21
|
-
resolve(value);
|
|
22
|
-
} else {
|
|
23
|
-
queue.push(value);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var shift = function shift() {
|
|
28
|
-
if (queue.length) {
|
|
29
|
-
return Promise.resolve(queue.shift());
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (shiftDeferred || (shiftDeferred = (0, _pDeferEs.default)())).promise;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
push: push,
|
|
37
|
-
shift: shift
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=createPromiseQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createPromiseQueue.js","names":["shiftDeferred","queue","push","value","resolve","shift","length","Promise","createDeferred","promise"],"sources":["../../src/Util/createPromiseQueue.js"],"sourcesContent":["import createDeferred from 'p-defer-es5';\n\nexport default function() {\n let shiftDeferred;\n const queue = [];\n\n const push = value => {\n if (shiftDeferred) {\n const { resolve } = shiftDeferred;\n\n shiftDeferred = null;\n resolve(value);\n } else {\n queue.push(value);\n }\n };\n\n const shift = () => {\n if (queue.length) {\n return Promise.resolve(queue.shift());\n }\n\n return (shiftDeferred || (shiftDeferred = createDeferred())).promise;\n };\n\n return {\n push,\n shift\n };\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEe,oBAAW;EACxB,IAAIA,aAAJ;EACA,IAAMC,KAAK,GAAG,EAAd;;EAEA,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAAAC,KAAK,EAAI;IACpB,IAAIH,aAAJ,EAAmB;MACjB,qBAAoBA,aAApB;MAAA,IAAQI,OAAR,kBAAQA,OAAR;MAEAJ,aAAa,GAAG,IAAhB;MACAI,OAAO,CAACD,KAAD,CAAP;IACD,CALD,MAKO;MACLF,KAAK,CAACC,IAAN,CAAWC,KAAX;IACD;EACF,CATD;;EAWA,IAAME,KAAK,GAAG,SAARA,KAAQ,GAAM;IAClB,IAAIJ,KAAK,CAACK,MAAV,EAAkB;MAChB,OAAOC,OAAO,CAACH,OAAR,CAAgBH,KAAK,CAACI,KAAN,EAAhB,CAAP;IACD;;IAED,OAAO,CAACL,aAAa,KAAKA,aAAa,GAAG,IAAAQ,iBAAA,GAArB,CAAd,EAAsDC,OAA7D;EACD,CAND;;EAQA,OAAO;IACLP,IAAI,EAAJA,IADK;IAELG,KAAK,EAALA;EAFK,CAAP;AAID"}
|
package/lib/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _SpeechServices = _interopRequireDefault(require("./SpeechServices"));
|
|
11
|
-
|
|
12
|
-
var _default = _SpeechServices.default;
|
|
13
|
-
exports.default = _default;
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SpeechServices"],"sources":["../src/index.js"],"sourcesContent":["import SpeechServices from './SpeechServices';\n\nexport default SpeechServices;\n"],"mappings":";;;;;;;;;AAAA;;eAEeA,uB"}
|