@jambonz/speech-utils 0.1.11 → 0.1.12

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/.husky/pre-commit CHANGED
@@ -1,3 +1,3 @@
1
- npm audit
1
+ #npm audit
2
2
  npm run jslint:fix || true
3
3
  npm test
@@ -1,7 +1,9 @@
1
1
  const { STSClient, GetSessionTokenCommand, AssumeRoleCommand } = require('@aws-sdk/client-sts');
2
2
  const {makeAwsKey, noopLogger} = require('./utils');
3
3
  const debug = require('debug')('jambonz:speech-utils');
4
- const EXPIRY = 3600;
4
+ const EXPIRY = process.env.AWS_STS_SESSION_DURATION || 3600;
5
+ // by default reset aws session before expiry time 10 mins
6
+ const CACHE_EXPIRY = process.env.AWS_STS_SESSION_RESET_EXPIRY || (EXPIRY - 600);
5
7
 
6
8
  async function getAwsAuthToken(
7
9
  logger, createHash, retrieveHash,
@@ -39,8 +41,7 @@ async function getAwsAuthToken(
39
41
  securityToken: data.Credentials.SessionToken
40
42
  };
41
43
 
42
- /* expire 10 minutes before the hour, so we don't lose the use of it during a call */
43
- createHash(key, credentials, EXPIRY - 600)
44
+ createHash(key, credentials, CACHE_EXPIRY)
44
45
  .catch((err) => logger.error(err, `Error saving hash for key ${key}`));
45
46
 
46
47
  return {...credentials, servedFromCache: false};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/speech-utils",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "TTS-related speech utilities for jambonz",
5
5
  "main": "index.js",
6
6
  "author": "Dave Horton",
@@ -36,7 +36,7 @@
36
36
  "form-urlencoded": "^6.1.4",
37
37
  "google-protobuf": "^3.21.2",
38
38
  "ibm-watson": "^8.0.0",
39
- "microsoft-cognitiveservices-speech-sdk": "1.36.0",
39
+ "microsoft-cognitiveservices-speech-sdk": "1.38.0",
40
40
  "openai": "^4.25.0",
41
41
  "undici": "^6.4.0"
42
42
  },