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.
Files changed (100) hide show
  1. package/dist/web-speech-cognitive-services.d.mts +329 -0
  2. package/dist/web-speech-cognitive-services.d.ts +329 -0
  3. package/dist/web-speech-cognitive-services.development.js +25746 -0
  4. package/dist/web-speech-cognitive-services.development.js.map +1 -0
  5. package/dist/web-speech-cognitive-services.js +1409 -0
  6. package/dist/web-speech-cognitive-services.js.map +1 -0
  7. package/dist/web-speech-cognitive-services.mjs +1374 -0
  8. package/dist/web-speech-cognitive-services.mjs.map +1 -0
  9. package/dist/web-speech-cognitive-services.production.min.js +31 -0
  10. package/dist/web-speech-cognitive-services.production.min.js.map +1 -0
  11. package/package.json +67 -47
  12. package/CHANGELOG.md +0 -372
  13. package/lib/BingSpeech/SpeechToText/SpeechGrammarList.js +0 -94
  14. package/lib/BingSpeech/SpeechToText/SpeechGrammarList.js.map +0 -1
  15. package/lib/BingSpeech/SpeechToText/createSpeechRecognitionPonyfill.js +0 -483
  16. package/lib/BingSpeech/SpeechToText/createSpeechRecognitionPonyfill.js.map +0 -1
  17. package/lib/BingSpeech/SpeechToText.js +0 -14
  18. package/lib/BingSpeech/SpeechToText.js.map +0 -1
  19. package/lib/BingSpeech/TextToSpeech/AudioContextConsumer.js +0 -122
  20. package/lib/BingSpeech/TextToSpeech/AudioContextConsumer.js.map +0 -1
  21. package/lib/BingSpeech/TextToSpeech/AudioContextQueue.js +0 -104
  22. package/lib/BingSpeech/TextToSpeech/AudioContextQueue.js.map +0 -1
  23. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js +0 -264
  24. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisUtterance.js.map +0 -1
  25. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js +0 -61
  26. package/lib/BingSpeech/TextToSpeech/SpeechSynthesisVoice.js.map +0 -1
  27. package/lib/BingSpeech/TextToSpeech/buildSSML.js +0 -32
  28. package/lib/BingSpeech/TextToSpeech/buildSSML.js.map +0 -1
  29. package/lib/BingSpeech/TextToSpeech/createSpeechSynthesisPonyfill.js +0 -220
  30. package/lib/BingSpeech/TextToSpeech/createSpeechSynthesisPonyfill.js.map +0 -1
  31. package/lib/BingSpeech/TextToSpeech/fetchSpeechData.js +0 -74
  32. package/lib/BingSpeech/TextToSpeech/fetchSpeechData.js.map +0 -1
  33. package/lib/BingSpeech/TextToSpeech/fetchVoices.js +0 -335
  34. package/lib/BingSpeech/TextToSpeech/fetchVoices.js.map +0 -1
  35. package/lib/BingSpeech/TextToSpeech/isSSML.js +0 -13
  36. package/lib/BingSpeech/TextToSpeech/isSSML.js.map +0 -1
  37. package/lib/BingSpeech/TextToSpeech/subscribeEvent.js +0 -14
  38. package/lib/BingSpeech/TextToSpeech/subscribeEvent.js.map +0 -1
  39. package/lib/BingSpeech/TextToSpeech.js +0 -14
  40. package/lib/BingSpeech/TextToSpeech.js.map +0 -1
  41. package/lib/BingSpeech/Util/DOMEventEmitter.js +0 -61
  42. package/lib/BingSpeech/Util/DOMEventEmitter.js.map +0 -1
  43. package/lib/BingSpeech/Util/createFetchTokenUsingSubscriptionKey.js +0 -41
  44. package/lib/BingSpeech/Util/createFetchTokenUsingSubscriptionKey.js.map +0 -1
  45. package/lib/BingSpeech/fetchAuthorizationToken.js +0 -57
  46. package/lib/BingSpeech/fetchAuthorizationToken.js.map +0 -1
  47. package/lib/BingSpeech/index.js +0 -84
  48. package/lib/BingSpeech/index.js.map +0 -1
  49. package/lib/SpeechServices/SpeechSDK.js +0 -19
  50. package/lib/SpeechServices/SpeechSDK.js.map +0 -1
  51. package/lib/SpeechServices/SpeechToText/SpeechGrammarList.js +0 -45
  52. package/lib/SpeechServices/SpeechToText/SpeechGrammarList.js.map +0 -1
  53. package/lib/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js +0 -56
  54. package/lib/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js.map +0 -1
  55. package/lib/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js +0 -984
  56. package/lib/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js.map +0 -1
  57. package/lib/SpeechServices/SpeechToText.js +0 -24
  58. package/lib/SpeechServices/SpeechToText.js.map +0 -1
  59. package/lib/SpeechServices/TextToSpeech/AudioContextConsumer.js +0 -92
  60. package/lib/SpeechServices/TextToSpeech/AudioContextConsumer.js.map +0 -1
  61. package/lib/SpeechServices/TextToSpeech/AudioContextQueue.js +0 -111
  62. package/lib/SpeechServices/TextToSpeech/AudioContextQueue.js.map +0 -1
  63. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js +0 -40
  64. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js.map +0 -1
  65. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js +0 -283
  66. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js.map +0 -1
  67. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js +0 -63
  68. package/lib/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js.map +0 -1
  69. package/lib/SpeechServices/TextToSpeech/buildSSML.js +0 -32
  70. package/lib/SpeechServices/TextToSpeech/buildSSML.js.map +0 -1
  71. package/lib/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js +0 -282
  72. package/lib/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js.map +0 -1
  73. package/lib/SpeechServices/TextToSpeech/fetchCustomVoices.js +0 -110
  74. package/lib/SpeechServices/TextToSpeech/fetchCustomVoices.js.map +0 -1
  75. package/lib/SpeechServices/TextToSpeech/fetchSpeechData.js +0 -127
  76. package/lib/SpeechServices/TextToSpeech/fetchSpeechData.js.map +0 -1
  77. package/lib/SpeechServices/TextToSpeech/fetchVoices.js +0 -87
  78. package/lib/SpeechServices/TextToSpeech/fetchVoices.js.map +0 -1
  79. package/lib/SpeechServices/TextToSpeech/isSSML.js +0 -13
  80. package/lib/SpeechServices/TextToSpeech/isSSML.js.map +0 -1
  81. package/lib/SpeechServices/TextToSpeech/subscribeEvent.js +0 -14
  82. package/lib/SpeechServices/TextToSpeech/subscribeEvent.js.map +0 -1
  83. package/lib/SpeechServices/TextToSpeech.js +0 -14
  84. package/lib/SpeechServices/TextToSpeech.js.map +0 -1
  85. package/lib/SpeechServices/fetchAuthorizationToken.js +0 -58
  86. package/lib/SpeechServices/fetchAuthorizationToken.js.map +0 -1
  87. package/lib/SpeechServices/patchOptions.js +0 -213
  88. package/lib/SpeechServices/patchOptions.js.map +0 -1
  89. package/lib/SpeechServices/resolveFunctionOrReturnValue.js +0 -11
  90. package/lib/SpeechServices/resolveFunctionOrReturnValue.js.map +0 -1
  91. package/lib/SpeechServices.js +0 -73
  92. package/lib/SpeechServices.js.map +0 -1
  93. package/lib/Util/arrayToMap.js +0 -28
  94. package/lib/Util/arrayToMap.js.map +0 -1
  95. package/lib/Util/createPromiseQueue.js +0 -40
  96. package/lib/Util/createPromiseQueue.js.map +0 -1
  97. package/lib/index.js +0 -14
  98. package/lib/index.js.map +0 -1
  99. package/umd/web-speech-cognitive-services.development.js +0 -4740
  100. package/umd/web-speech-cognitive-services.production.min.js +0 -2
package/package.json CHANGED
@@ -1,7 +1,43 @@
1
1
  {
2
2
  "name": "web-speech-cognitive-services",
3
- "version": "7.1.4-master.151bc9b",
3
+ "version": "8.0.0-main.15b930d",
4
4
  "description": "Polyfill Web Speech API with Cognitive Services Speech-to-Text service",
5
+ "files": [
6
+ "./dist/**/*"
7
+ ],
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/web-speech-cognitive-services.d.mts",
12
+ "default": "./dist/web-speech-cognitive-services.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/web-speech-cognitive-services.d.ts",
16
+ "default": "./dist/web-speech-cognitive-services.js"
17
+ }
18
+ }
19
+ },
20
+ "main": "./dist/web-speech-cognitive-services.js",
21
+ "typings": "./dist/web-speech-cognitive-services.d.ts",
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix",
25
+ "bump:auditfix": "npm audit fix || exit 0",
26
+ "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
27
+ "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
28
+ "precommit": "npm run precommit:eslint && npm run precommit:typescript:production && npm run precommit:typescript:test",
29
+ "precommit:eslint": "eslint ./src/",
30
+ "precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json",
31
+ "precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json",
32
+ "prepack": "cp ../../CHANGELOG.md . && cp ../../LICENSE . && cp ../../README.md .",
33
+ "switch": "cat package.json | jq --arg SWITCH_NAME $SWITCH_NAME -r '(.[\"switch:\" + $SWITCH_NAME] // {}) as $TEMPLATE | .devDependencies += ($TEMPLATE.devDependencies // {}) | .dependencies += ($TEMPLATE.dependencies // {})' | tee ./package.json.tmp && mv ./package.json.tmp ./package.json",
34
+ "start": "npm run build -- --onSuccess \"touch ../pages/src/app/index.jsx\" --watch",
35
+ "test": "jest"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/compulim/web-speech-cognitive-services.git"
40
+ },
5
41
  "keywords": [
6
42
  "cognitive services",
7
43
  "dictation",
@@ -23,64 +59,48 @@
23
59
  "webrtc",
24
60
  "webspeech"
25
61
  ],
26
- "main": "lib/index.js",
27
- "files": [
28
- "lib/**/*",
29
- "umd/**/*"
30
- ],
31
- "scripts": {
32
- "build": "babel --out-dir lib --ignore **/*.spec.js,**/*.test.js --source-maps true src/",
33
- "bump": "npm run bump:prod && npm run bump:dev",
34
- "bump:dev": "npm install --legacy-peer-deps $(cat package.json | jq -r '(.devDependencies | keys) - (.skipBump | keys) | .[]' | awk '{print $1 \"@latest\"}')",
35
- "bump:prod": "npm install --legacy-peer-deps --save-exact $(cat package.json | jq -r '(.dependencies | keys) - (.skipBump | keys) | .[]' | awk '{print $1 \"@latest\"}')",
36
- "clean": "rimraf lib",
37
- "eslint": "eslint src/**/*.js",
38
- "prepublishOnly": "npm run eslint && npm run build",
39
- "start": "npm run build -- --skip-initial-build --watch",
40
- "test": "jest"
41
- },
42
62
  "author": "William Wong <compulim@hotmail.com> (http://compulim.info/)",
43
63
  "license": "MIT",
44
- "repository": {
45
- "type": "git",
46
- "url": "git+https://github.com/compulim/web-speech-cognitive-services.git"
47
- },
48
64
  "bugs": {
49
65
  "url": "https://github.com/compulim/web-speech-cognitive-services/issues"
50
66
  },
51
67
  "homepage": "https://github.com/compulim/web-speech-cognitive-services#readme",
52
- "skipBump": {
53
- "node-fetch": "node-fetch@3 does not support CommonJS"
68
+ "pinDependencies": {
69
+ "node-fetch": [
70
+ "2",
71
+ "jsdom does not support node-fetch@3 because missing TextDecoder"
72
+ ]
54
73
  },
55
74
  "devDependencies": {
56
- "@babel/cli": "^7.18.10",
57
- "@babel/core": "^7.19.1",
58
- "@babel/plugin-proposal-object-rest-spread": "^7.18.9",
59
- "@babel/plugin-transform-runtime": "^7.19.1",
60
- "@babel/preset-env": "^7.19.1",
61
- "babel-jest": "^29.0.3",
62
- "babel-plugin-transform-inline-environment-variables": "^0.4.4",
63
- "dotenv": "^16.0.2",
64
- "eslint": "^8.24.0",
75
+ "@babel/preset-env": "^7.24.6",
76
+ "@babel/preset-typescript": "^7.24.6",
77
+ "@jest/globals": "^29.7.0",
78
+ "@tsconfig/recommended": "^1.0.6",
79
+ "@tsconfig/strictest": "^2.0.5",
80
+ "@types/dom-speech-recognition": "^0.0.4",
81
+ "@types/jest": "^29.5.12",
82
+ "@types/node": "^20.13.0",
83
+ "dotenv": "^16.4.5",
84
+ "esbuild": "^0.21.4",
65
85
  "global-agent": "^3.0.0",
66
- "jest": "^29.0.3",
67
- "jest-environment-jsdom": "^29.0.3",
86
+ "jest": "^29.7.0",
87
+ "jest-environment-jsdom": "^29.7.0",
68
88
  "lolex": "^6.0.0",
69
- "microsoft-cognitiveservices-speech-sdk": "^1.17.0",
70
- "node-fetch": "^2.6.7",
71
- "prettier": "^2.7.1",
72
- "rimraf": "^3.0.2"
89
+ "microsoft-cognitiveservices-speech-sdk": "^1.36.0",
90
+ "node-fetch": "^2.7.0",
91
+ "p-defer": "^4.0.1",
92
+ "prettier": "^3.3.0",
93
+ "tsup": "^8.0.2",
94
+ "typescript": "^5.4.5"
73
95
  },
74
96
  "dependencies": {
75
- "@babel/runtime": "7.19.0",
76
- "base64-arraybuffer": "1.0.2",
77
- "event-as-promise": "1.0.5",
78
- "event-target-shim": "6.0.2",
79
- "memoize-one": "6.0.0",
80
- "on-error-resume-next": "1.1.0",
81
- "p-defer": "4.0.0",
82
- "p-defer-es5": "2.0.1",
83
- "simple-update-in": "2.2.0"
97
+ "base64-arraybuffer": "^1.0.2",
98
+ "event-as-promise": "^2.0.0",
99
+ "event-target-shim": "^6.0.2",
100
+ "memoize-one": "^6.0.0",
101
+ "on-error-resume-next": "^2.0.1",
102
+ "simple-update-in": "^2.2.0",
103
+ "web-speech-cognitive-services": "^8.0.0-main.15b930d"
84
104
  },
85
105
  "peerDependencies": {
86
106
  "microsoft-cognitiveservices-speech-sdk": "^1.17.0"
package/CHANGELOG.md DELETED
@@ -1,372 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
- and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
-
7
- ## [Unreleased]
8
-
9
- ### Changed
10
-
11
- ## [7.1.3] - 2022-11-29
12
-
13
- - Bumped dependencies, in PR [#200](https://github.com/compulim/web-speech-cognitive-services/pull/200)
14
- - Development dependencies
15
- - [`microsoft-cognitiveservices-speech-sdk@1.17.0`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk)
16
-
17
- ## [7.1.2] - 2022-09-27
18
-
19
- ### Changed
20
-
21
- - Bumped dependencies, in PR [#196](https://github.com/compulim/web-speech-cognitive-services/pull/196)
22
- - Production dependencies
23
- - [`@babel/runtime@7.19.0`](https://npmjs.com/package/@babel/runtime)
24
- - [`base64-arraybuffer@1.0.2`](https://npmjs.com/package/base64-arraybuffer)
25
- - [`memoize-one@6.0.0`](https://npmjs.com/package/memoize-one)
26
- - [`p-defer-es5@2.0.1`](https://npmjs.com/package/p-defer-es5)
27
- - Development dependencies
28
- - [`@babel/cli@7.18.10`](https://npmjs.com/package/@babel/cli)
29
- - [`@babel/core@7.19.1`](https://npmjs.com/package/@babel/core)
30
- - [`@babel/plugin-proposal-object-rest-spread@7.18.9`](https://npmjs.com/package/@babel/plugin-proposal-object-rest-spread)
31
- - [`@babel/plugin-transform-runtime@7.19.1`](https://npmjs.com/package/@babel/plugin-transform-runtime)
32
- - [`@babel/preset-env@7.19.1`](https://npmjs.com/package/@babel/preset-env)
33
- - [`@babel/preset-react@7.18.6`](https://npmjs.com/package/@babel/preset-react)
34
- - [`babel-jest@29.0.3`](https://npmjs.com/package/babel-jest)
35
- - [`babel-plugin-transform-inline-environment-variables@0.4.4`](https://npmjs.com/package/babel-plugin-transform-inline-environment-variables)
36
- - [`classnames@2.3.2`](https://npmjs.com/package/classnames)
37
- - [`concurrently@7.4.0`](https://npmjs.com/package/concurrently)
38
- - [`dotenv@16.0.2`](https://npmjs.com/package/dotenv)
39
- - [`eslint@8.24.0`](https://npmjs.com/package/eslint)
40
- - [`global-agent@3.0.0`](https://npmjs.com/package/global-agent)
41
- - [`jest@29.0.3`](https://npmjs.com/package/jest)
42
- - [`microsoft-cognitiveservices-speech-sdk@1.23.0`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk)
43
- - [`node-fetch@2.6.7`](https://npmjs.com/package/node-fetch)
44
- - [`p-defer-es5@2.0.1`](https://npmjs.com/package/p-defer-es5)
45
- - [`prettier@2.7.1`](https://npmjs.com/package/prettier)
46
- - [`react-dom@18.2.0`](https://npmjs.com/package/react-dom)
47
- - [`react-redux@8.0.4`](https://npmjs.com/package/react-redux)
48
- - [`react-say@2.1.0`](https://npmjs.com/package/react-say)
49
- - [`react-scripts@5.0.1`](https://npmjs.com/package/react-scripts)
50
- - [`react@18.2.0`](https://npmjs.com/package/react)
51
- - [`redux-saga@1.2.1`](https://npmjs.com/package/redux-saga)
52
- - [`redux@4.2.0`](https://npmjs.com/package/redux)
53
- - [`webpack-cli@4.10.0`](https://npmjs.com/package/webpack-cli)
54
- - [`webpack-stats-plugin@1.1.0`](https://npmjs.com/package/webpack-stats-plugin)
55
- - [`webpack@5.74.0`](https://npmjs.com/package/webpack)
56
-
57
- ## [7.1.1] - 2021-07-20
58
-
59
- ### Changed
60
-
61
- - Bumped dependencies, in PR [#151](https://github.com/compulim/web-speech-cognitive-services/pull/151), PR [#152](https://github.com/compulim/web-speech-cognitive-services/pull/152) and PR [#153](https://github.com/compulim/web-speech-cognitive-services/pull/153)
62
- - [`@babel/cli@7.14.5`](https://npmjs.com/package/@babel/cli)
63
- - [`@babel/core@7.14.6`](https://npmjs.com/package/@babel/core)
64
- - [`@babel/plugin-proposal-object-rest-spread@7.14.7`](https://npmjs.com/package/@babel/plugin-proposal-object-rest-spread)
65
- - [`@babel/plugin-transform-runtime@7.14.5`](https://npmjs.com/package/@babel/plugin-transform-runtime)
66
- - [`@babel/preset-env@7.14.7`](https://npmjs.com/package/@babel/preset-env)
67
- - [`@babel/preset-react@7.14.5`](https://npmjs.com/package/@babel/preset-react)
68
- - [`@babel/runtime@7.14.6`](https://npmjs.com/package/@babel/runtime)
69
- - [`babel-jest@27.0.6`](https://npmjs.com/package/babel-jest)
70
- - [`classnames@2.3.1`](https://npmjs.com/package/classnames)
71
- - [`concurrently@6.2.0`](https://npmjs.com/package/concurrently)
72
- - [`dotenv@10.0.0`](https://npmjs.com/package/dotenv)
73
- - [`eslint@7.30.0`](https://npmjs.com/package/eslint)
74
- - [`event-target-shim@6.0.2`](https://npmjs.com/package/event-target-shim)
75
- - [`global-agent@2.2.0`](https://npmjs.com/package/global-agent)
76
- - [`jest@27.0.6`](https://npmjs.com/package/jest)
77
- - [`lerna@4.0.0`](https://npmjs.com/package/lerna)
78
- - [`memoize-one@5.2.1`](https://npmjs.com/package/memoize-one)
79
- - [`microsoft-cognitiveservices-speech-sdk@1.17.0`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk)
80
- - [`p-defer-es5@2.0.0`](https://npmjs.com/package/p-defer-es5)
81
- - [`p-defer@4.0.0`](https://npmjs.com/package/p-defer)
82
- - [`prettier@2.3.2`](https://npmjs.com/package/prettier)
83
- - [`react-dictate-button@2.0.1`](https://npmjs.com/package/react-dictate-button)
84
- - [`react-dom@17.0.2`](https://npmjs.com/package/react-dom)
85
- - [`react-redux@7.2.4`](https://npmjs.com/package/react-redux)
86
- - [`react-scripts@4.0.3`](https://npmjs.com/package/react-scripts)
87
- - [`react@17.0.2`](https://npmjs.com/package/react)
88
- - [`redux@4.1.0`](https://npmjs.com/package/redux)
89
- - [`webpack-cli@4.7.2`](https://npmjs.com/package/webpack-cli)
90
- - [`webpack-stats-plugin@1.0.3`](https://npmjs.com/package/webpack-stats-plugin)
91
- - [`webpack@5.44.0`](https://npmjs.com/package/webpack)
92
-
93
- ## [7.1.0] - 2021-02-01
94
-
95
- ### Changed
96
-
97
- - Moved from [`webpack-visualizer-plugin`](https://npmjs.com/package/webpack-visualizer-plugin) to [`webpack-stats-plugin`](https://npmjs.com/package/webpack-stats-plugin)
98
- - Bumped production dependencies
99
- - [`@babel/runtime@7.12.5`](https://npmjs.com/package/@babel/runtime)
100
- - [`event-target-shim@6.0.2`](https://npmjs.com/package/event-target-shim)
101
- - Bumped development dependencies
102
- - [`@babel/cli@7.12.10`](https://npmjs.com/package/@babel/cli)
103
- - [`@babel/core@7.12.10`](https://npmjs.com/package/@babel/core)
104
- - [`@babel/plugin-proposal-object-rest-spread@7.12.1`](https://npmjs.com/package/@babel/plugin-proposal-object-rest-spread)
105
- - [`@babel/plugin-transform-runtime@7.12.10`](https://npmjs.com/package/@babel/plugin-transform-runtime)
106
- - [`@babel/preset-env@7.12.11`](https://npmjs.com/package/@babel/preset-env)
107
- - [`babel-jest@26.6.3`](https://npmjs.com/package/babel-jest)
108
- - [`eslint@7.18.0`](https://npmjs.com/package/eslint)
109
- - [`global-agent@2.1.12`](https://npmjs.com/package/global-agent)
110
- - [`jest@26.6.3`](https://npmjs.com/package/jest)
111
- - [`microsoft-cognitiveservices-speech-sdk@1.15.0`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk)
112
- - [`node-fetch@2.6.1`](https://npmjs.com/package/node-fetch)
113
- - [`p-defer-es5@1.2.1`](https://npm.js.com/package/p-defer-es5)
114
- - [`prettier@2.2.1`](https://npmjs.com/package/prettier)
115
- - [`react-dom@17.0.1`](https://npm.js.com/package/react-dom)
116
- - [`react-redux@7.2.2`](https://npm.js.com/package/react-redux)
117
- - [`react-say@2.0.1`](https://npm.js.com/package/react-say)
118
- - [`react-scripts@4.0.1`](https://npm.js.com/package/react-scripts)
119
- - [`react@17.0.1`](https://npm.js.com/package/react)
120
- - [`simple-update-in@2.2.0`](https://npm.js.com/package/simple-update-in)
121
-
122
- ## [7.0.1] - 2020-08-06
123
-
124
- ### Changed
125
-
126
- - Bumped dependencies
127
- - [`event-target-shim-es5@1.2.0`](https://npmjs.com/package/event-target-shim-es5)
128
- - [`p-defer-es5@1.2.1`](https://npmjs.com/package/p-defer-es5)
129
-
130
- ## [7.0.0] - 2020-05-27
131
-
132
- ### Breaking changes
133
-
134
- - To enable developers to select their version of Cognitive Services Speech SDK and use newer features, we are moving [`microsoft-cognitiveservices-speech-sdk`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk) to `peerDependencies`.
135
- - When you install `web-speech-cognitive-services`, you will also need to install a compatible version of `microsoft-cognitiveservices-speech-sdk`.
136
-
137
- ### Changed
138
-
139
- - Fixes [#96](https://github.com/compulim/web-speech-cognitive-services/issues/96), move [`microsoft-cognitiveservices-speech-sdk`](https://npmjs.com/package/microsoft-cognitive-services-speech-sdk) to `peerDependencies`, by [@compulim](https://github.com/compulim), in PR [#97](https://github.com/compulim/web-speech-cognitive-services/pull/97)
140
-
141
- ## [6.3.0] - 2020-03-28
142
-
143
- ### Changed
144
-
145
- - Debumped [`microsoft-cognitiveservices-speech-sdk@1.9.1`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk), by [@compulim](https://github.com/compulim) in PR [#94](https://github.com/compulim/web-speech-cognitive-services/pull/94)
146
-
147
- ## [6.2.0] - 2020-03-27
148
-
149
- ### Breaking changes
150
-
151
- - Temporarily reverting breaking changes by reintroducing Bing Speech and `fetchAuthorizationToken`, by [@compulim](https://github.com/compulim) in PR [#92](https://github.com/compulim/web-speech-cognitive-services/pull/92).
152
-
153
- ## [6.1.0] - 2020-03-26
154
-
155
- ### Breaking changes
156
-
157
- - ~As Bing Speech has deprecated and removed from Azure. Bing Speech support has been removed.~
158
- - ~`fetchAuthorizationToken` is removed, please refer to [this documentation on how to get an access token](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-speech-to-text#how-to-get-an-access-token).~
159
-
160
- ### Added
161
-
162
- - Resolves [#88](https://github.com/compulim/web-speech-cognitive-services/issues/88). Support sovereign cloud, by [@compulim](https://github.com/compulim) in PR [#89](https://github.com/compulim/web-speech-cognitive-services/pull/89)
163
-
164
- ### Removed
165
-
166
- - ~Bing Speech support is removed, by [@compulim](https://github.com/compulim), in PR [#87](https://github.com/compulim/web-speech-cognitive-services/pull/87).~
167
- - ~`fetchAuthorizationToken` is removed, by [@compulim](https://github.com/compulim), in PR [#89](https://github.com/compulim/web-speech-cognitive-services/pull/89).~
168
-
169
- ### Changed
170
-
171
- - Bumped dependencies, in PR [#87](https://github.com/compulim/web-speech-cognitive-services/pull/87), by [@compulim](https://github.com/compulim)
172
- - Production dependencies
173
- - [`@babel/runtime@7.8.7`](https://npmjs.com/package/@babel/runtime)
174
- - [`event-target-shim-es5@1.0.1`](https://npmjs.com/package/event-target-shim-es5)
175
- - [`event-target-shim@5.0.1`](https://npmjs.com/package/event-target-shim)
176
- - [`memoize-one@5.1.1`](https://npmjs.com/package/memoize-one)
177
- - [`microsoft-cognitiveservices-speech-sdk@1.10.1`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk)
178
- - [`simple-update-in@2.1.1`](https://npmjs.com/package/simple-update-in)
179
- - Development dependencies
180
- - [`@babel/cli@7.8.4`](https://npmjs.com/package/@babel/cli)
181
- - [`@babel/core@7.8.7`](https://npmjs.com/package/@babel/core)
182
- - [`@babel/plugin-proposal-object-rest-spread@7.8.3`](https://npmjs.com/package/@babel/plugin-proposal-object-rest-spread)
183
- - [`@babel/plugin-transform-runtime@7.8.3`](https://npmjs.com/package/@babel/plugin-transform-runtime)
184
- - [`@babel/preset-env@7.8.7`](https://npmjs.com/package/@babel/preset-env)
185
- - [`@babel/preset-react@7.8.3`](https://npmjs.com/package/@babel/preset-react)
186
- - [`@lerna@3.20.2`](https://npmjs.com/package/@lerna)
187
- - [`babel-jest@25.1.0`](https://npmjs.com/package/babel-jest)
188
- - [`concurrently@4.1.2`](https://npmjs.com/package/concurrently)
189
- - [`eslint@6.8.0`](https://npmjs.com/package/eslint)
190
- - [`jest@25.1.0`](https://npmjs.com/package/jest)
191
- - [`lolex@5.1.2`](https://npmjs.com/package/lolex)
192
- - [`webpack-cli@3.3.11`](https://npmjs.com/package/webpack-cli)
193
- - [`webpack@4.42.0`](https://npmjs.com/package/webpack)
194
- - Use [`p-defer-es5`](https://npmjs.com/package/p-defer-es5) instead of adopted `createDeferred.js`, in PR [#89](https://github.com/compulim/web-speech-cognitive-services/pull/89).
195
-
196
- ## [6.0.0] - 2019-12-03
197
-
198
- ### Breaking changes
199
-
200
- #### Unifying options to pass credentials
201
-
202
- `authorizationToken`, `region`, and `subscriptionKey` are being deprecated in favor of `credentials` options. `credentials` can be one of the following types:
203
-
204
- - `{ authorizationToken: string, region: string? }`
205
- - `{ region: string?, subscriptionKey: string }`
206
- - `Promise<{ authorizationToken: string, region: string? }>`
207
- - `Promise<{ region: string?, subscriptionKey: string }>`
208
- - `() => { authorizationToken: string, region: string? }`
209
- - `() => { region: string?, subscriptionKey: string }`
210
- - `() => Promise<{ authorizationToken: string, region: string? }>`
211
- - `() => Promise<{ region: string?, subscriptionKey: string }>`
212
-
213
- If `credentials` is a function, it will be called just before the credentials is needed and may be called very frequently. This behavior matches the deprecating `authorizationToken`. The result of the call is also expected to be cached.
214
-
215
- If `region` is not returned, the default value of `"westus"` will be used.
216
-
217
- ### Fixed
218
-
219
- - Speech recognition: Removed extraneous finalized `result` event in continuous mode, by [@compulim](https://github.com/compulim), in PR [#79](https://github.com/compulim/web-speech-cognitive-services/pull/79)
220
-
221
- ### Removed
222
-
223
- - 🔥 `authorizationToken`, `region`, and `subscriptionKey` are being deprecated in favor of `credentials` options, by [@compulim](https://github.com/compulim) in PR [#80](https://github.com/compulim/web-speech-cognitive-services/pull/80)
224
-
225
- ### Added
226
-
227
- - `playground`: Add delayed start to playground for testing speech recognition initiated outside of user gestures, in PR [#78](https://github.com/compulim/web-speech-congitive-services/pull/78)
228
- - Speech recognition: New `looseEvents` option, default is `false`. When enabled, we will no longer follow observed browser event order. We will send finalized `result` event as early as possible. This will not break conformance to W3C specifications. By [@compulim](https://github.com/compulim), in PR [#79](https://github.com/compulim/web-speech-cognitive-services/pull/79)
229
- - Speech recognition: Create ponyfill using `SpeechRecognizer` object from [`microsoft-cognitiveservices-speech-sdk`](https://npmjs.com/package/microsoft-cognitiveservices-speech-sdk), by [@compulim](https://github.com/compulim), in PR [#73](https://github.com/compulim/web-speech-cognitive-services/pull/73)
230
- - `credentials` option is added for obtaining authorization token and region, or subscription key and region, in a single object or function call, by [@compulim](https://github.com/compulim) in PR [#80](https://github.com/compulim/web-speech-cognitive-services/pull/80)
231
- - Speech recognition: Polyfill will have `abort`/`stop` function set to `undefined` if the underlying recognizer from Cognitive Services SDK does not support stop/abort, in PR [#81](https://github.com/compulim/web-speech-cognitive-services/pull/81)
232
-
233
- ### Changed
234
-
235
- - Bumped dependencies, in PR [#73](https://github.com/compulim/web-speech-cognitive-services/pull/73)
236
- - [babel-jest@^24.9.0](https://www.npmjs.com/package/babel-jest)
237
- - [jest@^24.9.0](https://www.npmjs.com/package/jest)
238
- - [rimraf@^3.0.0](https://www.npmjs.com/package/rimraf)
239
-
240
- ## [5.0.1] - 2019-10-25
241
-
242
- ### Changed
243
-
244
- - Fixed dependences in PR [#76](https://github.com/compulim/web-speech-cognitive-services/pull/76)
245
- - `bundle` package
246
- - `dependencies`: Moved `eslint` to development dependencies
247
- - `component` package
248
- - `peerDependencies`: No longer requires `react`
249
- - `dependencies`
250
- - Moved `eslint` to development dependencies
251
- - Removed `event-target-shim` because incompatibility with ES5
252
- - `devDependencies`: Removed `react`
253
- - Removed `import '@babel/runtime'` explicitly
254
-
255
- ## [5.0.0] - 2019-10-23
256
-
257
- ### Breaking changes
258
-
259
- - Instead of stopping `AudioContext` after all pending utterances are finished, the `AudioContext` is now persisted. If this is not desirable in your application and would like to control the lifetime of `AudioContext` object, please create your own instance and pass it as an option named `audioContext` when creating the ponyfill
260
- - `createSpeechServicesPonyfill` function is no longer asynchronous
261
- - Immediate after the ponyfill is created, we will fetch voice list from the services and emit `voiceschanged` event on completion
262
-
263
- ### Added
264
-
265
- - Speech recognition: Fix [#23](https://github.com/compulim/web-speech-cognitive-services/issues/23) and [#24](https://github.com/compulim/web-speech-cognitive-services/issues/24), support `audiostart`/`audioend`/`soundstart`/`soundend` event, in PR [#33](https://github.com/compulim/web-speech-cognitive-services/pull/33)
266
- - Speech recognition: Fix [#25](https://github.com/compulim/web-speech-cognitive-services/issues/25) and [#26](https://github.com/compulim/web-speech-cognitive-services/issues/26), support true `abort` and `stop` function, in PR [#33](https://github.com/compulim/web-speech-cognitive-services/pull/33)
267
- - Speech recognition: Fix [#29](https://github.com/compulim/web-speech-cognitive-services/issues/29), support continuous mode, in PR [#33](https://github.com/compulim/web-speech-cognitive-services/pull/33)
268
- - Quirks: in continuous mode, calling `stop` in-between `recognizing` and `recognized` will not emit final `result` event
269
- - Speech recognition: New `audioConfig` option to override the default `AudioConfig.fromDefaultMicrophoneInput`, in PR [#33](https://github.com/compulim/web-speech-cognitive-services/pull/33)
270
- - Speech synthesis: Fix [#32](https://github.com/compulim/web-speech-cognitive-services/issues/32), fetch voices from services, in PR [#35](https://github.com/compulim/web-speech-cognitive-services/pull/35)
271
- - Speech synthesis: Fix [#34](https://github.com/compulim/web-speech-cognitive-services/issues/34), in PR [#36](https://github.com/compulim/web-speech-cognitive-services/pull/36) and PR [#44](https://github.com/compulim/web-speech-cognitive-services/pull/44)
272
- - Support user-controlled `AudioContext` object to be passed as an option named `audioContext`
273
- - If no `audioContext` option is passed, will create a new `AudioContext` object on first synthesis
274
- - Speech synthesis: If an empty utterance is being synthesized, will play an local empty audio clip, in PR [#36](https://github.com/compulim/web-speech-cognitive-services/pull/36)
275
- - Speech recognition: Fix [#30](https://github.com/compulim/web-speech-cognitive-services/issues/30), support dynamic phrases, in PR [#37](https://github.com/compulim/web-speech-cognitive-services/pull/37)
276
- - Pass it as an array to `SpeechRecognition.grammars.phrases`
277
- - Speech recognition: Fix [#31](https://github.com/compulim/web-speech-cognitive-services/issues/31), support reference grammars, in PR [#37](https://github.com/compulim/web-speech-cognitive-services/pull/37)
278
- - When creating the ponyfill, pass it as an array to `referenceGrammars` options
279
- - Speech recognition: Fix [#27](https://github.com/compulim/web-speech-cognitive-services/issues/27), support custom speech, in PR [#41](https://github.com/compulim/web-speech-cognitive-services/pull/41)
280
- - Use option `speechRecognitionEndpointId`
281
- - Speech synthesis: Fix [#28](https://github.com/compulim/web-speech-cognitive-services/issues/28) and [#62](https://github.com/compulim/web-speech-cognitive-services/issues/62), support custom voice font, in PR [#41](https://github.com/compulim/web-speech-cognitive-services/pull/41) and PR [#67](https://github.com/compulim/web-speech-cognitive-services/pull/67)
282
- - Use option `speechSynthesisDeploymentId`
283
- - Voice list is only fetch when using subscription key
284
- - Speech synthesis: Fix [#48](https://github.com/compulim/web-speech-cognitive-services/issues/48), support output format through `outputFormat` option, in PR [#49](https://github.com/compulim/web-speech-cognitive-services/pull/49)
285
- - `*`: Fix [#47](https://github.com/compulim/web-speech-cognitive-services/issues/47), add `enableTelemetry` option for disabling collecting telemetry data in Speech SDK, in PR [#51](https://github.com/compulim/web-speech-cognitive-services/pull/51) and PR [#66](https://github.com/compulim/web-speech/cognitive-services/pull/66)
286
- - `*`: Fix [#53](https://github.com/compulim/web-speech-cognitive-services/issues/53), added ESLint, in PR [#54](https://github.com/compulim/web-speech-cognitive-services/pull/54)
287
- - Speech synthesis: Fix [#39](https://github.com/compulim/web-speech-cognitive-services/issues/39), support SSML utterance, in PR [#57](https://github.com/compulim/web-speech-cognitive-services/pull/57)
288
- - Speech recognition: Fix [#59](https://github.com/compulim/web-speech-cognitive-services/issues/59), support `stop()` function by finalizing partial speech, in PR [#60](https://github.com/compulim/web-speech-cognitive-services/pull/60)
289
- - Fix [#67](https://github.com/compulim/web-speech-cognitive-services/issues/67), add warning when using subscription key instead of authorization token, in PR [#69](https://github.com/compulim/web-speech-cognitive-services/pull/69)
290
- - Fix [#70](https://github.com/compulim/web-speech-cognitive-services/issues/70), fetch authorization token before every synthesis, in PR [#71](https://github.com/compulim/web-speech-cognitive-services/pull/71)
291
-
292
- ### Changed
293
-
294
- - Bumped dependencies, in PR [#20](https://github.com/compulim/web-speech-cognitive-services/pull/20)
295
- - [@babel/cli@^7.5.5](https://www.npmjs.com/package/@babel/cli)
296
- - [@babel/core@^7.5.5](https://www.npmjs.com/package/@babel/core)
297
- - [@babel/plugin-proposal-object-rest-spread@^7.5.5](https://www.npmjs.com/package/@babel/plugin-proposal-object-rest-spread)
298
- - [@babel/plugin-transform-runtime@^7.5.5](https://www.npmjs.com/package/@babel/plugin-transform-runtime)
299
- - [@babel/preset-env@^7.5.5](https://www.npmjs.com/package/@babel/preset-env)
300
- - [@babel/runtime@^7.5.5](https://www.npmjs.com/package/@babel/runtime)
301
- - [babel-jest@^24.8.0](https://www.npmjs.com/package/babel-jest)
302
- - [babel-plugin-transform-inline-environment-variables@^0.4.3](https://www.npmjs.com/package/babel-plugin-transform-inline-environment-variables)
303
- - [jest@^24.8.0](https://www.npmjs.com/package/jest)
304
- - [memoize-one@^5.0.5](https://www.npmjs.com/package/memoize-one)
305
- - [rimraf@^2.6.3](https://www.npmjs.com/package/rimraf)
306
- - [simple-update-in@^2.1.0](https://www.npmjs.com/package/simple-update-in)
307
- - Added version number as `<meta>` tag, in PR [#20](https://github.com/compulim/web-speech-cognitive-services/pull/20)
308
- - Added bundle distribution thru https://unpkg.com/web-speech-cognitive-services@latest/umd/, in PR [#21](https://github.com/compulim/web-speech-cognitive-services/pull/21)
309
- - Bumped to [microsoft-cognitiveservices-speech-sdk@1.6.0](https://www.npmjs.com/package/microsoft-cognitiveservices-speech-sdk), in PR [#22](https://github.com/compulim/web-speech-cognitive-services/pull/22)
310
- - Fix [#55](https://github.com/compulim/web-speech-cognitive-services/issues/55) and [#63](https://github.com/compulim/web-speech-cognitive-services/issues/63). Moves to [WHATWG `EventTarget` interface](https://dom.spec.whatwg.org/#interface-eventtarget), in PR [#56](https://github.com/compulim/web-speech-cognitive-services/pulls/56) and PR [#64](https://github.com/compulim/web-speech-cognitive-services/pulls/64)
311
- - Instead of including `event-target-shim@5.0.1`, we are adopting its source code, in PR [#72](https://github.com/compulim/web-speech-cognitive-services/pulls/72)
312
- - This is because the original package requires browser to support rest/spread operators
313
-
314
- ### Fixed
315
-
316
- - Fix [#45](https://github.com/compulim/web-speech-cognitive-services/issues/45). Speech synthesize should emit "start" and "error" if the synthesized audio clip cannot be fetch over the network, in PR [#46](https://github.com/compulim/web-speech-cognitive-services/issues/46)
317
-
318
- ## [4.0.0] - 2018-12-10
319
- ### Added
320
- - New playground for better debuggability
321
- - Support of Speech Services SDK, with automated unit tests for speech recognition
322
- - See [`SPEC-RECOGNITION.md`](SPEC-RECOGNITION.md) and [`SPEC-SYNTHESIS.md`](SPEC-SYNTHESIS.md) for quirks
323
- - Speech recognition: Support `stop` on Speech Services
324
- - Speech synthesis: Support `pause` and `resume` (with `pause` and `resume` event)
325
- - Speech synthesis: Support `speaking` property
326
-
327
- ### Changed
328
- - Ponyfill are now constructed based on options (authorization token, region, and subscription key)
329
- - A new set of ponyfill will be created every time an option has changed
330
-
331
- ### Fixed
332
- - Fix [#13](https://github.com/compulim/web-speech-cognitive-services/issues/13) Speech recognition: `SpeechRecognitionResult` should be iterable
333
-
334
- ## [3.0.0] - 2018-10-31
335
- ### Added
336
- - Speech Synthesis: Will async fetch speech token instead of throwing exception
337
-
338
- ### Changed
339
- - Use `@babel/runtime` and `@babel/plugin-tranform-runtime`, in favor of `babel-polyfill`
340
- - Better error handling on `null` token
341
- - Updated voice list from [https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/supported-languages](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/supported-languages)
342
- - Reliability around cancelling a playing utterance
343
- - Instead of shutting down the `AudioContext`, we will stop the `AudioBufferSourceNode` for a graceful stop
344
- - Simplify speech token authorization
345
- - `recognition.fetchToken = async () => return await 'your subscription key';`
346
- - `recognition.fetchToken = createFetchTokenUsingSubscriptionKey('your subscription key');`
347
- - `fetchToken` will be called every time a token is required, implementor should cache the token as needed
348
- - Bump to [`@babel/core@7.1.2`](https://npmjs.com/package/@babel/core/v/7.1.2) and [`jest@^23.6.0`](https://npmjs.com/package/jest/v/23.6.0)
349
- - Bump to [`react-scripts@2.0.4`](https://npmjs.com/package/react-scripts/v/2.0.4)
350
- - Publish `/packages/component/` instead of `/`
351
- - Bump to [`event-as-promise@1.0.5`](https://npmjs.com/package/event-as-promise/v/1.0.5)
352
-
353
- ## [2.1.0] - 2018-07-09
354
- ### Added
355
- - Speech priming via custom `SpeechGrammarList`
356
-
357
- ## [2.0.0] - 2018-07-09
358
- ### Added
359
- - SpeechSynthesis polyfill with Cognitive Services
360
-
361
- ### Changed
362
- - Removed `CognitiveServices` prefix
363
- - Renamed `CognitiveServicesSpeechGrammarList` to `SpeechGrammarList`
364
- - Renamed `CognitiveServicesSpeechRecognition` to `SpeechRecognition`
365
- - Removed default export, now must use `import { SpeechRecognition } from 'web-speech-cognitive-services';`
366
- - Speech Recognition: changed speech token authorization
367
- - `recognition.speechToken = new SubscriptionKey('your subscription key');`
368
-
369
- ## [1.0.0] - 2018-06-29
370
- ### Added
371
- - Initial release
372
- - SpeechRecognition polyfill with Cognitive Services
@@ -1,94 +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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _simpleUpdateIn = _interopRequireDefault(require("simple-update-in"));
17
-
18
- var _default = /*#__PURE__*/function () {
19
- function _default() {
20
- (0, _classCallCheck2.default)(this, _default);
21
- this._referenceGrammar = null;
22
- this._words = [];
23
- }
24
-
25
- (0, _createClass2.default)(_default, [{
26
- key: "addFromString",
27
- value: function addFromString() {
28
- throw new Error('JSGF is not supported');
29
- }
30
- }, {
31
- key: "referenceGrammar",
32
- get: function get() {
33
- return this._referenceGrammar;
34
- },
35
- set: function set(nextReferenceGrammar) {
36
- if (typeof nextReferenceGrammar !== 'string') {
37
- throw new Error('referenceGrammar must be a string');
38
- }
39
-
40
- this._referenceGrammar = nextReferenceGrammar;
41
- }
42
- }, {
43
- key: "words",
44
- get: function get() {
45
- return this._words;
46
- },
47
- set: function set(nextWords) {
48
- if (!Array.isArray(nextWords)) {
49
- throw new Error('words must be an Array');
50
- }
51
-
52
- this._words = nextWords;
53
- }
54
- }, {
55
- key: "createSpeechContext",
56
- value: function createSpeechContext() {
57
- var referenceGrammar = this.referenceGrammar,
58
- words = this.words;
59
- var speechContext;
60
-
61
- if (referenceGrammar) {
62
- speechContext = (0, _simpleUpdateIn.default)(speechContext, ['dgi', 'Groups'], function () {
63
- var groups = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
64
- return [].concat((0, _toConsumableArray2.default)(groups), [{
65
- Type: 'Generic',
66
- Hints: {
67
- ReferenceGrammar: referenceGrammar
68
- }
69
- }]);
70
- });
71
- }
72
-
73
- if (words && words.length) {
74
- speechContext = (0, _simpleUpdateIn.default)(speechContext, ['dgi', 'Groups'], function () {
75
- var groups = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
76
- return [].concat((0, _toConsumableArray2.default)(groups), [{
77
- Type: 'Generic',
78
- Items: words.map(function (word) {
79
- return {
80
- Text: word
81
- };
82
- })
83
- }]);
84
- });
85
- }
86
-
87
- return speechContext;
88
- }
89
- }]);
90
- return _default;
91
- }();
92
-
93
- exports.default = _default;
94
- //# sourceMappingURL=SpeechGrammarList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpeechGrammarList.js","names":["_referenceGrammar","_words","Error","nextReferenceGrammar","nextWords","Array","isArray","referenceGrammar","words","speechContext","updateIn","groups","Type","Hints","ReferenceGrammar","length","Items","map","word","Text"],"sources":["../../../src/BingSpeech/SpeechToText/SpeechGrammarList.js"],"sourcesContent":["import updateIn from 'simple-update-in';\n\nexport default class {\n constructor() {\n this._referenceGrammar = null;\n this._words = [];\n }\n\n addFromString() {\n throw new Error('JSGF is not supported');\n }\n\n get referenceGrammar() { return this._referenceGrammar; }\n set referenceGrammar(nextReferenceGrammar) {\n if (typeof nextReferenceGrammar !== 'string') {\n throw new Error('referenceGrammar must be a string');\n }\n\n this._referenceGrammar = nextReferenceGrammar;\n }\n\n get words() { return this._words; }\n set words(nextWords) {\n if (!Array.isArray(nextWords)) {\n throw new Error('words must be an Array');\n }\n\n this._words = nextWords;\n }\n\n createSpeechContext() {\n const { referenceGrammar, words } = this;\n let speechContext;\n\n if (referenceGrammar) {\n speechContext = updateIn(speechContext, ['dgi', 'Groups'], (groups = []) => [...groups, {\n Type: 'Generic',\n Hints: { ReferenceGrammar: referenceGrammar }\n }]);\n }\n\n if (words && words.length) {\n speechContext = updateIn(speechContext, ['dgi', 'Groups'], (groups = []) => [...groups, {\n Type: 'Generic',\n Items: words.map(word => ({ Text: word }))\n }]);\n }\n\n return speechContext;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;;EAGE,oBAAc;IAAA;IACZ,KAAKA,iBAAL,GAAyB,IAAzB;IACA,KAAKC,MAAL,GAAc,EAAd;EACD;;;;WAED,yBAAgB;MACd,MAAM,IAAIC,KAAJ,CAAU,uBAAV,CAAN;IACD;;;SAED,eAAuB;MAAE,OAAO,KAAKF,iBAAZ;IAAgC,C;SACzD,aAAqBG,oBAArB,EAA2C;MACzC,IAAI,OAAOA,oBAAP,KAAgC,QAApC,EAA8C;QAC5C,MAAM,IAAID,KAAJ,CAAU,mCAAV,CAAN;MACD;;MAED,KAAKF,iBAAL,GAAyBG,oBAAzB;IACD;;;SAED,eAAY;MAAE,OAAO,KAAKF,MAAZ;IAAqB,C;SACnC,aAAUG,SAAV,EAAqB;MACnB,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,SAAd,CAAL,EAA+B;QAC7B,MAAM,IAAIF,KAAJ,CAAU,wBAAV,CAAN;MACD;;MAED,KAAKD,MAAL,GAAcG,SAAd;IACD;;;WAED,+BAAsB;MACpB,IAAQG,gBAAR,GAAoC,IAApC,CAAQA,gBAAR;MAAA,IAA0BC,KAA1B,GAAoC,IAApC,CAA0BA,KAA1B;MACA,IAAIC,aAAJ;;MAEA,IAAIF,gBAAJ,EAAsB;QACpBE,aAAa,GAAG,IAAAC,uBAAA,EAASD,aAAT,EAAwB,CAAC,KAAD,EAAQ,QAAR,CAAxB,EAA2C;UAAA,IAACE,MAAD,uEAAU,EAAV;UAAA,kDAAqBA,MAArB,IAA6B;YACtFC,IAAI,EAAE,SADgF;YAEtFC,KAAK,EAAE;cAAEC,gBAAgB,EAAEP;YAApB;UAF+E,CAA7B;QAAA,CAA3C,CAAhB;MAID;;MAED,IAAIC,KAAK,IAAIA,KAAK,CAACO,MAAnB,EAA2B;QACzBN,aAAa,GAAG,IAAAC,uBAAA,EAASD,aAAT,EAAwB,CAAC,KAAD,EAAQ,QAAR,CAAxB,EAA2C;UAAA,IAACE,MAAD,uEAAU,EAAV;UAAA,kDAAqBA,MAArB,IAA6B;YACtFC,IAAI,EAAE,SADgF;YAEtFI,KAAK,EAAER,KAAK,CAACS,GAAN,CAAU,UAAAC,IAAI;cAAA,OAAK;gBAAEC,IAAI,EAAED;cAAR,CAAL;YAAA,CAAd;UAF+E,CAA7B;QAAA,CAA3C,CAAhB;MAID;;MAED,OAAOT,aAAP;IACD"}