@bespoken-sdk/store
Advanced tools
Comparing version 0.13.2 to 0.13.3
@@ -74,11 +74,13 @@ const _ = require('lodash') | ||
/** | ||
* @param {any} job | ||
* @param {string} key | ||
* @param {any} json | ||
* @returns {Promise<string>} The UUID assigned to the job | ||
*/ | ||
async save (job) { | ||
async save (key, json) { | ||
logger.time('SAVE') | ||
const url = `${Client.accessURL()}/save?run=${job.run}` | ||
const url = `${Client.accessURL()}/save?key=${key}` | ||
logger.info('URL for saving: ' + url) | ||
const jsonString = JSON.stringify(json) | ||
// Create a stream from the JSON | ||
const jsonStream = Readable.from(JSON.stringify(job)) | ||
const jsonStream = Readable.from(jsonString) | ||
const gzipStream = jsonStream.pipe(zlib.createGzip()) | ||
@@ -94,3 +96,2 @@ const response = await axios.post(url, gzipStream, { | ||
logger.timeEnd('SAVE') | ||
job.key = response.data.key | ||
return response.data.key | ||
@@ -105,2 +106,3 @@ } | ||
const url = `${Client.accessURL()}/decrypt?key=${key}` | ||
logger.info('decrypt: ' + url) | ||
const response = await axios.get(url) | ||
@@ -107,0 +109,0 @@ return response.data.decryptedKey |
@@ -9,3 +9,3 @@ { | ||
"dependencies": { | ||
"@bespoken-sdk/shared": "^0.13.2", | ||
"@bespoken-sdk/shared": "^0.13.3", | ||
"axios": "^0.21.4", | ||
@@ -21,4 +21,4 @@ "lodash": "^4.17.21" | ||
}, | ||
"version": "0.13.2", | ||
"gitHead": "5e4598d24f1444bce2719d46a2354781c985851d", | ||
"version": "0.13.3", | ||
"gitHead": "e9edafbc2fa387c2561cd38bff7c8f8b2e64ff42", | ||
"devDependencies": { | ||
@@ -25,0 +25,0 @@ "@types/node": "^16.10.1" |
11574
134
Updated@bespoken-sdk/shared@^0.13.3