Compare commits

...

19 Commits

Author SHA1 Message Date
Dave Horton
480e1155f3 0.7.2 version 2022-01-28 09:16:51 -05:00
Dave Horton
75e7c1058b lint 2022-01-27 15:31:11 -05:00
Dave Horton
a5e4fafda4 minor 2022-01-27 15:26:09 -05:00
Dave Horton
2e041df6e4 update deps 2022-01-27 09:04:54 -05:00
Snyk bot
3ee82d6c8c fix: upgrade passport from 0.5.0 to 0.5.2 (#24)
Snyk has created this PR to upgrade passport from 0.5.0 to 0.5.2.

See this package in npm:
https://www.npmjs.com/package/passport

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-27 08:33:19 -05:00
Snyk bot
d396c5b252 fix: upgrade aws-sdk from 2.1048.0 to 2.1049.0 (#26)
Snyk has created this PR to upgrade aws-sdk from 2.1048.0 to 2.1049.0.

See this package in npm:
https://www.npmjs.com/package/aws-sdk

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-27 08:32:04 -05:00
Snyk bot
daef0ee215 fix: upgrade form-urlencoded from 6.0.4 to 6.0.5 (#27)
Snyk has created this PR to upgrade form-urlencoded from 6.0.4 to 6.0.5.

See this package in npm:
https://www.npmjs.com/package/form-urlencoded

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-27 08:30:45 -05:00
Snyk bot
1d168e93e1 fix: package.json & package-lock.json to reduce vulnerabilities (#28)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-SWAGGERUIDIST-2314884
2022-01-27 08:30:30 -05:00
dependabot[bot]
605a0e762f Bump node-fetch from 2.6.1 to 2.6.7 (#30)
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-27 08:30:16 -05:00
Dave Horton
c9bf943656 initial changes to support wellsaid tts (#29) 2022-01-27 08:17:51 -05:00
Snyk bot
3aac11560a fix: upgrade mysql2 from 2.2.5 to 2.3.3 (#20)
Snyk has created this PR to upgrade mysql2 from 2.2.5 to 2.3.3.

See this package in npm:
https://www.npmjs.com/package/mysql2

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:53:19 -05:00
Snyk bot
bb4a20a375 fix: upgrade form-data from 2.3.3 to 2.5.1 (#22)
Snyk has created this PR to upgrade form-data from 2.3.3 to 2.5.1.

See this package in npm:
https://www.npmjs.com/package/form-data

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:52:55 -05:00
Snyk bot
45c4c626f2 fix: upgrade @google-cloud/text-to-speech from 3.2.2 to 3.4.0 (#19)
Snyk has created this PR to upgrade @google-cloud/text-to-speech from 3.2.2 to 3.4.0.

See this package in npm:
https://www.npmjs.com/package/@google-cloud/text-to-speech

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:52:39 -05:00
Snyk bot
65e6d75f72 fix: upgrade debug from 4.3.1 to 4.3.3 (#23)
Snyk has created this PR to upgrade debug from 4.3.1 to 4.3.3.

See this package in npm:
https://www.npmjs.com/package/debug

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:52:15 -05:00
Snyk bot
c6bb273aa0 fix: upgrade aws-sdk from 2.929.0 to 2.1048.0 (#14)
Snyk has created this PR to upgrade aws-sdk from 2.929.0 to 2.1048.0.

See this package in npm:
https://www.npmjs.com/package/aws-sdk

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:34:31 -05:00
Snyk bot
256b295be1 fix: upgrade stripe from 8.155.0 to 8.195.0 (#15)
Snyk has created this PR to upgrade stripe from 8.155.0 to 8.195.0.

See this package in npm:
https://www.npmjs.com/package/stripe

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:34:14 -05:00
Snyk bot
693ba51339 fix: upgrade mailgun.js from 3.4.0 to 3.7.3 (#16)
Snyk has created this PR to upgrade mailgun.js from 3.4.0 to 3.7.3.

See this package in npm:
https://www.npmjs.com/package/mailgun.js

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:33:58 -05:00
Snyk bot
531366ee58 fix: upgrade @google-cloud/speech from 4.5.2 to 4.9.0 (#17)
Snyk has created this PR to upgrade @google-cloud/speech from 4.5.2 to 4.9.0.

See this package in npm:
https://www.npmjs.com/package/@google-cloud/speech

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:33:14 -05:00
Snyk bot
a36604029c fix: upgrade @jambonz/realtimedb-helpers from 0.4.3 to 0.4.14 (#18)
Snyk has created this PR to upgrade @jambonz/realtimedb-helpers from 0.4.3 to 0.4.14.

See this package in npm:
https://www.npmjs.com/package/@jambonz/realtimedb-helpers

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:32:36 -05:00
5 changed files with 426 additions and 352 deletions

View File

@@ -10,7 +10,8 @@ const {
testAwsTts,
testAwsStt,
testMicrosoftStt,
testMicrosoftTts
testMicrosoftTts,
testWellSaidTts
} = require('../../utils/speech-utils');
router.post('/', async(req, res) => {
@@ -66,6 +67,12 @@ router.post('/', async(req, res) => {
});
encrypted_credential = encrypt(data);
}
else if (vendor === 'wellsaid') {
const data = JSON.stringify({
api_key
});
encrypted_credential = encrypt(data);
}
else throw new DbErrorBadRequest(`invalid speech vendor ${vendor}`);
const uuid = await SpeechCredential.make({
account_sid,
@@ -109,6 +116,10 @@ router.get('/', async(req, res) => {
obj.api_key = o.api_key;
obj.region = o.region;
}
else if ('wellsaid' === obj.vendor) {
const o = decrypt(credential);
obj.api_key = o.api_key;
}
return obj;
}));
} catch (err) {
@@ -291,6 +302,19 @@ router.get('/:sid/test', async(req, res) => {
}
}
}
else if (cred.vendor === 'wellsaid') {
const {api_key} = credential;
if (cred.use_for_tts) {
try {
await testWellSaidTts(logger, {api_key});
results.tts.status = 'ok';
SpeechCredential.ttsTestResult(sid, true);
} catch (err) {
results.tts = {status: 'fail', reason: err.message};
SpeechCredential.ttsTestResult(sid, false);
}
}
}
res.status(200).json(results);
} catch (err) {
sysError(logger, res, err);

View File

@@ -75,11 +75,37 @@ const testMicrosoftStt = async(logger, credentials) => {
return true;
};
const testWellSaidTts = async(logger, credentials) => {
const {api_key} = credentials;
try {
const post = bent('https://api.wellsaidlabs.com', 'POST', 'buffer', {
'X-Api-Key': api_key,
'Accept': 'audio/mpeg',
'Content-Type': 'application/json'
});
const mp3 = await post('/v1/tts/stream', {
text: 'Hello, world',
speaker_id: '3'
});
return mp3;
} catch (err) {
logger.info({err}, 'testWellSaidTts returned error');
throw err;
}
};
const testWellSaidStt = async(logger, credentials) => {
//TODO
return true;
};
module.exports = {
testGoogleTts,
testGoogleStt,
testAwsTts,
testWellSaidTts,
testAwsStt,
testMicrosoftTts,
testMicrosoftStt
testMicrosoftStt,
testWellSaidStt,
};

667
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,11 @@
{
"name": "jambonz-api-server",
"version": "v0.7.1",
"version": "v0.7.2",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js",
"test": "NODE_ENV=test APPLY_JAMBONZ_DB_LIMITS=1 JWT_SECRET=foobarbazzle JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=localhost JAMBONES_REDIS_PORT=16379 JAMBONES_TIME_SERIES_HOST=127.0.0.1 JAMBONES_LOGLEVEL=error JAMBONES_CREATE_CALL_URL=http://localhost/v1/createCall node test/ ",
"test": "NODE_ENV=test APPLY_JAMBONZ_DB_LIMITS=1 JWT_SECRET=foobarbazzle JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=localhost JAMBONES_REDIS_PORT=16379 JAMBONES_TIME_SERIES_HOST=127.0.0.1 JAMBONES_LOGLEVEL=info JAMBONES_CREATE_CALL_URL=http://localhost/v1/createCall node test/ ",
"integration-test": "NODE_ENV=test JAMBONES_TIME_SERIES_HOST=127.0.0.1 AWS_REGION='us-east-1' JAMBONES_CURRENCY=USD JWT_SECRET=foobarbazzle JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=localhost JAMBONES_REDIS_PORT=16379 JAMBONES_LOGLEVEL=debug JAMBONES_CREATE_CALL_URL=http://localhost/v1/createCall node test/serve-integration.js",
"upgrade-db": "node ./db/upgrade-jambonz-db.js",
"coverage": "./node_modules/.bin/nyc --reporter html --report-dir ./coverage npm run test",
@@ -17,30 +17,30 @@
"url": "https://github.com/jambonz/jambonz-api-server.git"
},
"dependencies": {
"@google-cloud/speech": "^4.2.0",
"@google-cloud/text-to-speech": "^3.1.3",
"@jambonz/db-helpers": "^0.6.12",
"@jambonz/realtimedb-helpers": "^0.4.3",
"@jambonz/time-series": "^0.1.5",
"@google-cloud/speech": "^4.9.0",
"@google-cloud/text-to-speech": "^3.4.0",
"@jambonz/db-helpers": "^0.6.16",
"@jambonz/realtimedb-helpers": "^0.4.17",
"@jambonz/time-series": "^0.1.6",
"argon2-ffi": "^2.0.0",
"aws-sdk": "^2.839.0",
"aws-sdk": "^2.1049.0",
"bent": "^7.3.12",
"cors": "^2.8.5",
"debug": "^4.3.1",
"debug": "^4.3.3",
"express": "^4.17.1",
"form-data": "^2.3.3",
"form-urlencoded": "^6.0.4",
"form-data": "^2.5.1",
"form-urlencoded": "^6.0.5",
"jsonwebtoken": "^8.5.1",
"mailgun.js": "^3.3.0",
"mailgun.js": "^3.7.3",
"microsoft-cognitiveservices-speech-sdk": "^1.19.0",
"mysql2": "^2.2.5",
"passport": "^0.5.0",
"mysql2": "^2.3.3",
"passport": "^0.5.2",
"passport-http-bearer": "^1.0.1",
"pino": "^5.17.0",
"request-debug": "^0.2.0",
"short-uuid": "^4.1.0",
"stripe": "^8.138.0",
"swagger-ui-express": "^4.1.6",
"stripe": "^8.195.0",
"swagger-ui-express": "^4.3.0",
"uuid": "^3.4.0",
"yamljs": "^0.3.0"
},

View File

@@ -133,6 +133,30 @@ test('speech credentials tests', async(t) => {
json: true,
});
console.log(JSON.stringify(result));
}
/* add a credential for wellsaid */
if (process.env.WELLSAID_API_KEY) {
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'wellsaid',
use_for_tts: true,
api_key: process.env.WELLSAID_API_KEY
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential');
const ms_sid = result.body.sid;
/* test the speech credential */
result = await request.get(`/Accounts/${account_sid}/SpeechCredentials/${ms_sid}/test`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
/* delete the credential */
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/${ms_sid}`, {
@@ -144,7 +168,6 @@ test('speech credentials tests', async(t) => {
await deleteObjectBySid(request, '/Accounts', account_sid);
await deleteObjectBySid(request, '/ServiceProviders', service_provider_sid);
//t.end();
}
catch (err) {