Comparing version 0.0.117 to 0.0.118
@@ -9,3 +9,2 @@ 'use strict' | ||
host; | ||
#default_value = null; | ||
#keys = { | ||
@@ -80,3 +79,3 @@ connection: 'connection', | ||
async #Set(type, key, value = this.#default_value) { | ||
async #Set(type, key, value) { | ||
try { | ||
@@ -83,0 +82,0 @@ const data = { |
@@ -412,3 +412,3 @@ 'use strict' | ||
/** | ||
* | ||
* data response actions | ||
* @param connectionId | ||
@@ -631,7 +631,17 @@ * @param data | ||
async Request(req) { | ||
/** | ||
* send request to peer | ||
* @param req | ||
* @param encode | ||
* @returns {Promise<void>} | ||
* @constructor | ||
*/ | ||
async Request(req, encode = true) { | ||
try { | ||
if(typeof req !== 'object') throw `Invalid request type: ${typeof req}`; | ||
if(encode) req = Util.Stringify(req); | ||
const connection = await this.GetAliveConnection(); | ||
await connection.Send({ | ||
method: 'request', | ||
encoded: encode, | ||
data: req | ||
@@ -644,7 +654,17 @@ }); | ||
async Response(res) { | ||
/** | ||
* send response to peer request | ||
* @param res | ||
* @param encode | ||
* @returns {Promise<void>} | ||
* @constructor | ||
*/ | ||
async Response(res, encode = true) { | ||
try { | ||
if(typeof res !== 'object') throw `Invalid response type: ${typeof res}`; | ||
if(encode) res = Util.Stringify(res); | ||
const connection = await this.GetAliveConnection(); | ||
await connection.Send({ | ||
method: 'response', | ||
encoded: encode, | ||
data: res | ||
@@ -657,2 +677,8 @@ }); | ||
/** | ||
* send loaded data | ||
* @param connection | ||
* @returns {Promise<unknown>} | ||
* @constructor | ||
*/ | ||
async SendData(connection) { | ||
@@ -709,4 +735,4 @@ return await new Promise(async (resolve, reject) => { | ||
result: (this.data.send.length === 0) ? 'success' : 'fail', | ||
sent: this.count.sent, | ||
failed: this.data.failed, | ||
sentCount: this.count.sent, | ||
failedCount: this.data.failed.length, | ||
timestamp: moment.now(), | ||
@@ -722,3 +748,3 @@ } | ||
await Util.Sleep(100); | ||
this.#Emit('send_finish', endData.data); | ||
this.#Emit('send_finish', {...endData.data, failed: this.data.failed}); | ||
}); | ||
@@ -732,3 +758,3 @@ } | ||
/** | ||
* | ||
* prepare array of tx objects to send | ||
* @param dataSequence: array of tx objects | ||
@@ -779,2 +805,8 @@ * @constructor | ||
/** | ||
* prepare encoded chunks of tx object array to send | ||
* @param dataChunkSequence | ||
* @returns {Promise<unknown>} | ||
* @constructor | ||
*/ | ||
async SetDataChunkSequence(dataChunkSequence) { | ||
@@ -811,3 +843,3 @@ return await new Promise((resolve, reject) => { | ||
/** | ||
* | ||
* send prepared array of tx objects | ||
* @param dataSequence: array of tx objects | ||
@@ -893,2 +925,8 @@ * @returns {Promise<void>} | ||
/** | ||
* send prepared chunks of tx object array | ||
* @param dataChunkSequence | ||
* @returns {Promise<void>} | ||
* @constructor | ||
*/ | ||
async SendDataChunkSequence(dataChunkSequence = null) { | ||
@@ -895,0 +933,0 @@ let interval; |
@@ -264,3 +264,8 @@ 'use strict' | ||
try { | ||
return await qrcode.toDataURL(this.id, option, cb); | ||
// return await qrcode.toDataURL(this.id, option, cb); | ||
console.log(this.id, option); | ||
const qr = await qrcode.toDataURL(this.id, option); | ||
return qr; | ||
} catch (e) { | ||
@@ -267,0 +272,0 @@ throw e; |
{ | ||
"name": "guardee", | ||
"version": "0.0.117", | ||
"version": "0.0.118", | ||
"description": "Guardee Wallet API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52500
1426