diff --git a/speech/package.json b/speech/package.json index e0902234332..282fbcb85f8 100644 --- a/speech/package.json +++ b/speech/package.json @@ -9,9 +9,9 @@ }, "dependencies": { "@google-cloud/speech": "0.9.0", - "@google-cloud/storage": "0.7.0", - "node-record-lpcm16": "0.2.0", - "yargs": "6.6.0" + "@google-cloud/storage": "1.0.0", + "node-record-lpcm16": "0.3.0", + "yargs": "7.0.2" }, "engines": { "node": ">=4.3.2" diff --git a/speech/quickstart.js b/speech/quickstart.js index 48c58b2c1d6..a2501407e69 100644 --- a/speech/quickstart.js +++ b/speech/quickstart.js @@ -42,5 +42,8 @@ speechClient.recognize(fileName, options) .then((results) => { const transcription = results[0]; console.log(`Transcription: ${transcription}`); + }) + .catch((err) => { + console.error('ERROR:', err); }); // [END speech_quickstart] diff --git a/speech/recognize.js b/speech/recognize.js index dcf56d30834..9563757d841 100644 --- a/speech/recognize.js +++ b/speech/recognize.js @@ -55,6 +55,9 @@ function syncRecognize (filename, encoding, sampleRateHertz, languageCode) { const transcription = results[0]; console.log(`Transcription: ${transcription}`); + }) + .catch((err) => { + console.error('ERROR:', err); }); // [END speech_sync_recognize] } @@ -91,6 +94,9 @@ function syncRecognizeGCS (gcsUri, encoding, sampleRateHertz, languageCode) { const transcription = results[0]; console.log(`Transcription: ${transcription}`); + }) + .catch((err) => { + console.error('ERROR:', err); }); // [END speech_sync_recognize_gcs] } @@ -131,6 +137,9 @@ function asyncRecognize (filename, encoding, sampleRateHertz, languageCode) { }) .then((transcription) => { console.log(`Transcription: ${transcription}`); + }) + .catch((err) => { + console.error('ERROR:', err); }); // [END speech_async_recognize] } @@ -171,6 +180,9 @@ function asyncRecognizeGCS (gcsUri, encoding, sampleRateHertz, languageCode) { }) .then((transcription) => { console.log(`Transcription: ${transcription}`); + }) + .catch((err) => { + console.error('ERROR:', err); }); // [END speech_async_recognize_gcs] } @@ -209,7 +221,7 @@ function streamingRecognize (filename, encoding, sampleRateHertz, languageCode) const recognizeStream = speech.createRecognizeStream(request) .on('error', console.error) .on('data', (data) => { - console.log('Data received: %j', data); + console.log(`Transcription: ${data.results}`); }); // Stream an audio file from disk to the Speech API, e.g. "./resources/audio.raw" diff --git a/speech/system-test/recognize.test.js b/speech/system-test/recognize.test.js index 9ba06fd8643..b86b5fe15f1 100644 --- a/speech/system-test/recognize.test.js +++ b/speech/system-test/recognize.test.js @@ -62,5 +62,5 @@ test(`should run async recognize on a GCS file`, async (t) => { test(`should run streaming recognize`, async (t) => { const output = await runAsync(`${cmd} stream ${filepath}`, cwd); - t.true(output.includes(text)); + t.true(output.includes(`Transcription: ${text}`)); }); diff --git a/speech/yarn.lock b/speech/yarn.lock index c3e237bb908..2df1d708685 100644 --- a/speech/yarn.lock +++ b/speech/yarn.lock @@ -2,60 +2,33 @@ # yarn lockfile v1 -"@google-cloud/common-grpc@^0.1.1": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@google-cloud/common-grpc/-/common-grpc-0.1.1.tgz#0facc6c5e90eb9072bd4b602451248250bbf3ba0" +"@google-cloud/common-grpc@^0.3.0": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@google-cloud/common-grpc/-/common-grpc-0.3.1.tgz#c29b8ce83bef2da409eb838fa187960bb8c3df2e" dependencies: - "@google-cloud/common" "^0.11.0" + "@google-cloud/common" "^0.13.0" dot-prop "^2.4.0" duplexify "^3.5.0" extend "^3.0.0" - google-proto-files "^0.8.6" - grpc "~1.0.1" + google-proto-files "^0.11.0" + grpc "^1.2.3" is "^3.2.0" + modelo "^4.2.0" retry-request "^1.3.2" through2 "^2.0.3" -"@google-cloud/common@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-0.11.0.tgz#5c94674a1ea9a4939865e342f0c1b909ca04e980" - dependencies: - array-uniq "^1.0.2" - arrify "^1.0.0" - concat-stream "^1.5.0" - create-error-class "^3.0.2" - dot-prop "^2.4.0" - duplexify "^3.2.0" - ent "^2.2.0" - extend "^3.0.0" - google-auto-auth "^0.5.0" - google-proto-files "^0.8.0" - grpc "^1.0.0" - is "^3.0.1" - log-driver "^1.2.5" - methmeth "^1.0.0" - modelo "^4.2.0" - request "^2.70.0" - retry-request "^1.3.0" - split-array-stream "^1.0.0" - stream-events "^1.0.1" - string-format-obj "^1.0.0" - through2 "^2.0.0" - -"@google-cloud/common@^0.12.0": - version "0.12.0" - resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-0.12.0.tgz#b1cb0922c70f7e5273e402b0a6ae71de2f32abc3" +"@google-cloud/common@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-0.13.0.tgz#d062439a75b38eb76c4704d20f5b45301a69f17f" dependencies: array-uniq "^1.0.3" arrify "^1.0.1" concat-stream "^1.6.0" create-error-class "^3.0.2" - dot-prop "^2.4.0" duplexify "^3.5.0" ent "^2.2.0" extend "^3.0.0" - google-auto-auth "^0.5.2" - google-proto-files "^0.8.6" + google-auto-auth "^0.6.0" is "^3.2.0" log-driver "^1.2.5" methmeth "^1.1.0" @@ -67,16 +40,16 @@ string-format-obj "^1.1.0" through2 "^2.0.3" -"@google-cloud/speech@0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@google-cloud/speech/-/speech-0.6.0.tgz#161e9bb3f3aca4ed7acb65e1fdd8286ac34b41e8" +"@google-cloud/speech@0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@google-cloud/speech/-/speech-0.9.0.tgz#97fcb47046cdaff66afbd05508cb38e42f61cdb5" dependencies: - "@google-cloud/common" "^0.12.0" - "@google-cloud/common-grpc" "^0.1.1" + "@google-cloud/common" "^0.13.0" + "@google-cloud/common-grpc" "^0.3.0" events-intercept "^2.0.0" extend "^3.0.0" - google-gax "^0.10.2" - google-proto-files "^0.8.0" + google-gax "^0.13.0" + google-proto-files "^0.11.0" is "^3.1.0" propprop "^0.3.1" pumpify "^1.3.5" @@ -85,11 +58,11 @@ string-format-obj "^1.1.0" through2 "^2.0.1" -"@google-cloud/storage@0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-0.7.0.tgz#87eb7bde35a1597511cba7b651e666178ac90fe1" +"@google-cloud/storage@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-1.0.0.tgz#cb6af3d8ce89a2e5b394adf2e5fa2bf83f36b2fd" dependencies: - "@google-cloud/common" "^0.12.0" + "@google-cloud/common" "^0.13.0" arrify "^1.0.0" async "^2.0.1" concat-stream "^1.5.0" @@ -133,7 +106,7 @@ arguejs@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/arguejs/-/arguejs-0.2.3.tgz#b6f939f5fe0e3cd1f3f93e2aa9262424bf312af7" -array-uniq@^1.0.2, array-uniq@^1.0.3: +array-uniq@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" @@ -186,7 +159,7 @@ balanced-match@^0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" -base64url@^2.0.0: +base64url@2.0.0, base64url@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/base64url/-/base64url-2.0.0.tgz#eac16e03ea1438eff9423d69baa36262ed1f70bb" @@ -232,7 +205,7 @@ brace-expansion@^1.0.0: balanced-match "^0.4.1" concat-map "0.0.1" -buffer-equal-constant-time@^1.0.1: +buffer-equal-constant-time@1.0.1, buffer-equal-constant-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" @@ -421,7 +394,7 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -ecdsa-sig-formatter@^1.0.0: +ecdsa-sig-formatter@1.0.9, ecdsa-sig-formatter@^1.0.0: version "1.0.9" resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz#4bc926274ec3b5abb5016e7e1d60921ac262b2a1" dependencies: @@ -528,6 +501,13 @@ gauge@~2.7.1: supports-color "^0.2.0" wide-align "^1.1.0" +gcp-metadata@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-0.1.0.tgz#abe21f1ea324dd0b34a3f06ca81763fb1eee37d9" + dependencies: + extend "^3.0.0" + retry-request "^1.3.2" + gcs-resumable-upload@^0.7.1: version "0.7.4" resolved "https://registry.yarnpkg.com/gcs-resumable-upload/-/gcs-resumable-upload-0.7.4.tgz#6633967badf7a4aed2d79337e7badfe889cfd617" @@ -585,6 +565,15 @@ glob@^7.0.5: once "^1.3.0" path-is-absolute "^1.0.0" +google-auth-library@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-0.10.0.tgz#6e15babee85fd1dd14d8d128a295b6838d52136e" + dependencies: + gtoken "^1.2.1" + jws "^3.1.4" + lodash.noop "^3.0.1" + request "^2.74.0" + google-auth-library@^0.9.10, google-auth-library@^0.9.6: version "0.9.10" resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-0.9.10.tgz#4993dc07bb4834b8ca0350213a6873a32c6051b9" @@ -603,7 +592,7 @@ google-auto-auth@^0.2.1: google-auth-library "^0.9.6" object-assign "^3.0.0" -google-auto-auth@^0.5.0, google-auto-auth@^0.5.2: +google-auto-auth@^0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/google-auto-auth/-/google-auto-auth-0.5.2.tgz#4c9f38574e69fb55a3c516ab0415e9fa33e67602" dependencies: @@ -612,17 +601,29 @@ google-auto-auth@^0.5.0, google-auto-auth@^0.5.2: object-assign "^3.0.0" request "^2.79.0" -google-gax@^0.10.2: - version "0.10.6" - resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-0.10.6.tgz#3af119704700fd212df6b9250e4b4a61676b3f96" +google-auto-auth@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/google-auto-auth/-/google-auto-auth-0.6.0.tgz#ad76656293d8d06b3c89c358becd29947d4510a8" + dependencies: + async "^2.1.2" + gcp-metadata "^0.1.0" + google-auth-library "^0.10.0" + object-assign "^3.0.0" + request "^2.79.0" + +google-gax@^0.13.0: + version "0.13.0" + resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-0.13.0.tgz#02571bcd556ddd58d86d8df3cc277cb8cecace86" dependencies: extend "^3.0.0" google-auto-auth "^0.5.2" - google-proto-files "^0.8.3" - grpc "~1.0" + google-proto-files "^0.9.1" + grpc "^1.2" + is-stream-ended "^0.1.0" lodash "^4.17.2" process-nextick-args "^1.0.7" readable-stream "^2.2.2" + through2 "^2.0.3" google-p12-pem@^0.1.0: version "0.1.1" @@ -630,9 +631,13 @@ google-p12-pem@^0.1.0: dependencies: node-forge "^0.6.46" -google-proto-files@^0.8.0, google-proto-files@^0.8.3, google-proto-files@^0.8.6: - version "0.8.6" - resolved "https://registry.yarnpkg.com/google-proto-files/-/google-proto-files-0.8.6.tgz#a7c8ddccd2179690d270b0ebfc42994d56da0ee6" +google-proto-files@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/google-proto-files/-/google-proto-files-0.11.0.tgz#3d753120718e5e8574f38def739d54cf7a057553" + +google-proto-files@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/google-proto-files/-/google-proto-files-0.9.1.tgz#c760c79059bf62ba3ac56e1d1ba7b8d4560803be" graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" @@ -642,9 +647,9 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" -grpc@^1.0.0, grpc@~1.0, grpc@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/grpc/-/grpc-1.0.1.tgz#e965544b5e56c998058102184e2ab1f27f123afd" +grpc@^1.2, grpc@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/grpc/-/grpc-1.2.3.tgz#60b4b533a8783fa0b389b6cfa5d5bee34786049f" dependencies: arguejs "^0.2.3" lodash "^4.15.0" @@ -652,7 +657,7 @@ grpc@^1.0.0, grpc@~1.0, grpc@~1.0.1: node-pre-gyp "^0.6.0" protobufjs "^5.0.0" -gtoken@^1.1.0: +gtoken@^1.1.0, gtoken@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-1.2.1.tgz#90153a547c2fc1cd24a4d3d2ab3b5aba0a26897a" dependencies: @@ -839,6 +844,15 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.3.6" +jwa@^1.1.4: + version "1.1.5" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.1.5.tgz#a0552ce0220742cd52e153774a32905c30e756e5" + dependencies: + base64url "2.0.0" + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.9" + safe-buffer "^5.0.1" + jwa@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.0.2.tgz#fd79609f1e772e299dce8ddb76d00659dd83511f" @@ -847,7 +861,15 @@ jwa@~1.0.0: buffer-equal-constant-time "^1.0.1" ecdsa-sig-formatter "^1.0.0" -jws@^3.0.0, jws@~3.0.0: +jws@^3.0.0, jws@^3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/jws/-/jws-3.1.4.tgz#f9e8b9338e8a847277d6444b1464f61880e050a2" + dependencies: + base64url "^2.0.0" + jwa "^1.1.4" + safe-buffer "^5.0.1" + +jws@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/jws/-/jws-3.0.0.tgz#da5f267897dd4e9cf8137979db33fc54a3c05418" dependencies: @@ -870,7 +892,7 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -lodash.noop@~3.0.0: +lodash.noop@^3.0.1, lodash.noop@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash.noop/-/lodash.noop-3.0.1.tgz#38188f4d650a3a474258439b96ec45b32617133c" @@ -899,7 +921,7 @@ meow@~2.0.0: minimist "^1.1.0" object-assign "^1.0.0" -methmeth@^1.0.0, methmeth@^1.1.0: +methmeth@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/methmeth/-/methmeth-1.1.0.tgz#e80a26618e52f5c4222861bb748510bd10e29089" @@ -967,9 +989,9 @@ node-pre-gyp@^0.6.0: tar "~2.2.1" tar-pack "~3.3.0" -node-record-lpcm16@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/node-record-lpcm16/-/node-record-lpcm16-0.2.0.tgz#ae8da285c66d08e68662f7a1df538d68a88cf3dc" +node-record-lpcm16@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/node-record-lpcm16/-/node-record-lpcm16-0.3.0.tgz#797eb70c509db4e982a32162147a7bae34eaacca" node-uuid@~1.4.7: version "1.4.7" @@ -1237,7 +1259,7 @@ request@2.76.0: tough-cookie "~2.3.0" tunnel-agent "~0.4.1" -request@^2.61.0, request@^2.70.0, request@^2.72.0, request@^2.74.0, request@^2.79.0: +request@^2.61.0, request@^2.72.0, request@^2.74.0, request@^2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" dependencies: @@ -1296,7 +1318,7 @@ require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" -retry-request@^1.3.0, retry-request@^1.3.2: +retry-request@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/retry-request/-/retry-request-1.3.2.tgz#59ad24e71f8ae3f312d5f7b4bcf467a5e5a57bd6" dependencies: @@ -1555,15 +1577,15 @@ y18n@^3.2.0, y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" -yargs-parser@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" +yargs-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" dependencies: camelcase "^3.0.0" -yargs@6.6.0: - version "6.6.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" +yargs@7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.0.2.tgz#115b97df1321823e8b8648e8968c782521221f67" dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -1577,7 +1599,7 @@ yargs@6.6.0: string-width "^1.0.2" which-module "^1.0.0" y18n "^3.2.1" - yargs-parser "^4.2.0" + yargs-parser "^5.0.0" yargs@^3.10.0: version "3.32.0"