@fonos/voice
Advanced tools
Comparing version 0.1.15-alpha.0 to 0.1.16-alpha.0
@@ -45,3 +45,3 @@ "use strict"; | ||
clearTimeout(timer); | ||
resolve(result.transcription); | ||
resolve(result.transcript); | ||
}) | ||
@@ -48,0 +48,0 @@ .catch(reject) |
@@ -9,2 +9,4 @@ import { GatherOptions } from "./gather/gather"; | ||
import { Plugin } from "@fonos/common"; | ||
import { SGatherOptions } from "./sgather/gather"; | ||
import { SGatherStream } from "./sgather/types"; | ||
/** | ||
@@ -89,3 +91,3 @@ * @classdesc Use the VoiceResponse object, to construct advance Interactive | ||
* @param {string} options.source - Where to listen as input source. This option accepts `dtmf` and `speech`. A speech provider must be configure | ||
* when including the `speech` option. You might inclue both with `dtmf,speech`. Defaults to `dtmf` | ||
* when including the `speech` source. You might inclue both with `dtmf,speech`. Defaults to `dtmf` | ||
* @note When including `speech` the default timeout is 10000 (10s). | ||
@@ -102,2 +104,28 @@ * @see SpeechProvider | ||
/** | ||
* Waits for data entry from the user's keypad or from a stream speech provider. This command is different than `gather` | ||
* in that it returns a stream of results instead of a single result. You can think of it as active listening. | ||
* | ||
* @param {SGatherOptions} options - Options to select the | ||
* @param {string} options.source - Where to listen as input source. This option accepts `dtmf` and `speech`. A speech provider must be configure | ||
* when including the `speech` source. You might inclue both with `dtmf,speech`. Defaults to `speech,dtmf` | ||
* @return {SGatherStream} The SGatherStream fires events via am `on` method for `transcription`, `dtmf`, and `error`. And the stream can be close | ||
* with the `close` function. | ||
* @see StreamSpeechProvider | ||
* @example | ||
* | ||
* async function handler (request, response) { | ||
* const stream = await response.sgather({source: "dtmf,speech"}); | ||
* | ||
* stream.on("transcript", (text, isFinal) => { | ||
* console.log("transcript: %s", text); | ||
* }) | ||
* | ||
* stream.on("dtmf", digit => { | ||
* console.log("digit: " + digit); | ||
* if (digit === "#") stream.close(); | ||
* }) | ||
* } | ||
*/ | ||
sgather(options: SGatherOptions): Promise<SGatherStream>; | ||
/** | ||
* Returns a PlaybackControl control object. | ||
@@ -104,0 +132,0 @@ * |
@@ -35,2 +35,3 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
const gather_2 = __importDefault(require("./sgather/gather")); | ||
/** | ||
@@ -127,3 +128,3 @@ * @classdesc Use the VoiceResponse object, to construct advance Interactive | ||
* @param {string} options.source - Where to listen as input source. This option accepts `dtmf` and `speech`. A speech provider must be configure | ||
* when including the `speech` option. You might inclue both with `dtmf,speech`. Defaults to `dtmf` | ||
* when including the `speech` source. You might inclue both with `dtmf,speech`. Defaults to `dtmf` | ||
* @note When including `speech` the default timeout is 10000 (10s). | ||
@@ -147,2 +148,35 @@ * @see SpeechProvider | ||
/** | ||
* Waits for data entry from the user's keypad or from a stream speech provider. This command is different than `gather` | ||
* in that it returns a stream of results instead of a single result. You can think of it as active listening. | ||
* | ||
* @param {SGatherOptions} options - Options to select the | ||
* @param {string} options.source - Where to listen as input source. This option accepts `dtmf` and `speech`. A speech provider must be configure | ||
* when including the `speech` source. You might inclue both with `dtmf,speech`. Defaults to `speech,dtmf` | ||
* @return {SGatherStream} The SGatherStream fires events via am `on` method for `transcription`, `dtmf`, and `error`. And the stream can be close | ||
* with the `close` function. | ||
* @see StreamSpeechProvider | ||
* @example | ||
* | ||
* async function handler (request, response) { | ||
* const stream = await response.sgather({source: "dtmf,speech"}); | ||
* | ||
* stream.on("transcript", (text, isFinal) => { | ||
* console.log("transcript: %s", text); | ||
* }) | ||
* | ||
* stream.on("dtmf", digit => { | ||
* console.log("digit: " + digit); | ||
* if (digit === "#") stream.close(); | ||
* }) | ||
* } | ||
*/ | ||
async sgather(options) { | ||
let asr = null; | ||
if (options.source.includes("speech")) { | ||
asserts_1.assertPluginExist(this, "asr"); | ||
asr = this.plugins["asr"]; | ||
} | ||
return await new gather_2.default(this.request, asr).run(options); | ||
} | ||
/** | ||
* Returns a PlaybackControl control object. | ||
@@ -149,0 +183,0 @@ * |
{ | ||
"name": "@fonos/voice", | ||
"version": "0.1.15-alpha.0", | ||
"version": "0.1.16-alpha.0", | ||
"description": "Voice verbs", | ||
@@ -32,7 +32,2 @@ "author": "Pedro Sanders <psanders@fonoster.com>", | ||
"dependencies": { | ||
"@fonos/common": "^0.1.14-alpha.0", | ||
"@fonos/events": "^0.1.11-alpha.3", | ||
"@fonos/googleasr": "^0.1.14-alpha.1", | ||
"@fonos/logger": "^0.1.11-alpha.3", | ||
"@fonos/tts": "^0.1.11-alpha.3", | ||
"axios": "^0.21.1", | ||
@@ -46,3 +41,3 @@ "deepmerge": "^4.2.2", | ||
}, | ||
"gitHead": "7a833c17eac8137eb59f5f6f386cde0a78b63a0f", | ||
"gitHead": "6a105830fd42883439ae18ae7b480ba8d040eb79", | ||
"devDependencies": { | ||
@@ -49,0 +44,0 @@ "@types/pubsub-js": "^1.8.2" |
61074
7
56
1518
- Removed@fonos/common@^0.1.14-alpha.0
- Removed@fonos/events@^0.1.11-alpha.3
- Removed@fonos/googleasr@^0.1.14-alpha.1
- Removed@fonos/logger@^0.1.11-alpha.3
- Removed@fonos/tts@^0.1.11-alpha.3
- Removed@colors/colors@1.6.0(transitive)
- Removed@dabh/diagnostics@2.0.3(transitive)
- Removed@fonos/certs@0.1.24(transitive)
- Removed@fonos/common@0.1.24(transitive)
- Removed@fonos/events@0.1.24(transitive)
- Removed@fonos/googleasr@0.1.25(transitive)
- Removed@fonos/logger@0.1.24(transitive)
- Removed@fonos/tts@0.1.24(transitive)
- Removed@google-cloud/common@3.10.0(transitive)
- Removed@google-cloud/projectify@2.1.1(transitive)
- Removed@google-cloud/promisify@2.0.4(transitive)
- Removed@google-cloud/speech@4.10.2(transitive)
- Removed@grpc/grpc-js@1.12.61.6.12(transitive)
- Removed@grpc/proto-loader@0.6.130.7.13(transitive)
- Removed@js-sdsl/ordered-map@4.4.2(transitive)
- Removed@protobufjs/aspromise@1.1.2(transitive)
- Removed@protobufjs/base64@1.1.2(transitive)
- Removed@protobufjs/codegen@2.0.4(transitive)
- Removed@protobufjs/eventemitter@1.1.0(transitive)
- Removed@protobufjs/fetch@1.1.0(transitive)
- Removed@protobufjs/float@1.0.2(transitive)
- Removed@protobufjs/inquire@1.1.0(transitive)
- Removed@protobufjs/path@1.1.2(transitive)
- Removed@protobufjs/pool@1.1.0(transitive)
- Removed@protobufjs/utf8@1.1.0(transitive)
- Removed@speedymonster/grpc-interceptors@0.2.5(transitive)
- Removed@tootallnate/once@2.0.0(transitive)
- Removed@types/duplexify@3.6.4(transitive)
- Removed@types/jsonwebtoken@8.5.9(transitive)
- Removed@types/long@4.0.2(transitive)
- Removed@types/node@22.13.5(transitive)
- Removed@types/pumpify@1.4.4(transitive)
- Removed@types/triple-beam@1.3.5(transitive)
- Removedabort-controller@3.0.0(transitive)
- Removedacme-client@4.2.5(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedamqp-connection-manager@3.9.0(transitive)
- Removedamqplib@0.8.0(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedarrify@2.0.1(transitive)
- Removedassertion-error@1.1.0(transitive)
- Removedasync@3.2.6(transitive)
- Removedatob@2.1.2(transitive)
- Removedaxios@0.26.1(transitive)
- Removedbacko2@1.0.2(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbignumber.js@9.1.2(transitive)
- Removedbitsyntax@0.1.0(transitive)
- Removedbluebird@3.7.2(transitive)
- Removedbtoa@1.2.1(transitive)
- Removedbuffer-equal-constant-time@1.0.1(transitive)
- Removedbuffer-more-ints@1.0.0(transitive)
- Removedchai@4.5.0(transitive)
- Removedcheck-error@1.0.3(transitive)
- Removedcliui@7.0.48.0.1(transitive)
- Removedcolor@3.2.1(transitive)
- Removedcolor-convert@1.9.32.0.1(transitive)
- Removedcolor-name@1.1.31.1.4(transitive)
- Removedcolor-string@1.9.1(transitive)
- Removedcolorspace@1.1.4(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddeep-eql@4.1.4(transitive)
- Removedduplexify@4.1.3(transitive)
- Removedecdsa-sig-formatter@1.0.11(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedenabled@2.0.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedent@2.2.2(transitive)
- Removedescalade@3.2.0(transitive)
- Removedevent-lite@0.1.3(transitive)
- Removedevent-target-shim@5.0.1(transitive)
- Removedextend@3.0.2(transitive)
- Removedfast-text-encoding@1.0.6(transitive)
- Removedfecha@4.2.3(transitive)
- Removedflat@5.0.2(transitive)
- Removedfluent-logger@3.4.1(transitive)
- Removedfn.name@1.1.0(transitive)
- Removedgaxios@4.3.3(transitive)
- Removedgcp-metadata@4.3.1(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedget-func-name@2.0.2(transitive)
- Removedgoogle-auth-library@7.14.1(transitive)
- Removedgoogle-gax@2.30.5(transitive)
- Removedgoogle-p12-pem@3.1.4(transitive)
- Removedgtoken@5.3.2(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhttp-proxy-agent@5.0.0(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedieee754@1.2.1(transitive)
- Removedint64-buffer@0.1.10(transitive)
- Removedis-arrayish@0.3.2(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-promise@2.2.2(transitive)
- Removedis-regex@1.2.1(transitive)
- Removedis-stream@1.1.02.0.1(transitive)
- Removedis-stream-ended@0.1.4(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedjson-bigint@1.0.0(transitive)
- Removedjsonwebtoken@8.5.1(transitive)
- Removedjwa@1.4.12.0.0(transitive)
- Removedjws@3.2.24.0.0(transitive)
- Removedkuler@2.0.0(transitive)
- Removedlodash.camelcase@4.3.0(transitive)
- Removedlodash.includes@4.3.0(transitive)
- Removedlodash.isboolean@3.0.3(transitive)
- Removedlodash.isinteger@4.0.4(transitive)
- Removedlodash.isnumber@3.0.3(transitive)
- Removedlodash.isplainobject@4.0.6(transitive)
- Removedlodash.isstring@4.0.1(transitive)
- Removedlodash.once@4.1.1(transitive)
- Removedlogform@2.7.0(transitive)
- Removedlong@4.0.05.3.1(transitive)
- Removedloupe@2.3.7(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmsgpack-lite@0.1.26(transitive)
- Removednetwork-address@1.1.2(transitive)
- Removednode-fetch@1.7.32.7.0(transitive)
- Removednode-forge@1.3.1(transitive)
- Removednode-record-lpcm16@1.0.1(transitive)
- Removedobject-hash@3.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedone-time@1.0.0(transitive)
- Removedpathval@1.1.1(transitive)
- Removedpromise-breaker@5.0.0(transitive)
- Removedproto3-json-serializer@0.1.9(transitive)
- Removedprotobufjs@6.11.36.11.47.4.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedpumpify@2.0.1(transitive)
- Removedpunycode@1.4.1(transitive)
- Removedquerystringify@2.2.0(transitive)
- Removedreadable-stream@1.1.143.6.2(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedrequires-port@1.0.0(transitive)
- Removedretry-request@4.2.2(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsafe-regex-test@1.1.0(transitive)
- Removedsafe-stable-stringify@2.5.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsimple-swizzle@0.2.2(transitive)
- Removedsox-audio@0.3.0(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedstream-events@1.0.5(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstring_decoder@0.10.311.3.0(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedstubs@3.0.0(transitive)
- Removedteeny-request@7.2.0(transitive)
- Removedtext-hex@1.0.0(transitive)
- Removedthrough@2.3.8(transitive)
- Removedtr46@0.0.3(transitive)
- Removedtriple-beam@1.4.1(transitive)
- Removedtype-detect@4.1.0(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedurl-parse@1.5.10(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@8.3.2(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwinston@3.17.0(transitive)
- Removedwinston-transport@4.9.0(transitive)
- Removedwrap-ansi@7.0.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedy18n@5.0.8(transitive)
- Removedyallist@4.0.0(transitive)
- Removedyargs@16.2.017.7.2(transitive)
- Removedyargs-parser@20.2.921.1.1(transitive)
- Removedzipkin@0.12.0(transitive)
- Removedzipkin-transport-http@0.12.0(transitive)