Comparing version 2.1.0 to 2.1.1
# Changelog | ||
## [2.1.1] | ||
- Improve timeout handling for SkyDB | ||
- Extend end-to-end tests | ||
## [2.1.0] | ||
@@ -4,0 +9,0 @@ |
@@ -90,3 +90,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var customFilename, skylink, existing, result, error_1, value, signature, updated; | ||
var customFilename, skylink, existing, error_1, value, signature, updated; | ||
return __generator(this, function (_a) { | ||
@@ -102,6 +102,5 @@ switch (_a.label) { | ||
_a.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, Promise.all([utils_1.timeout(2000), this.lookupRegistry(user, fileID)])]; | ||
return [4 /*yield*/, utils_1.promiseTimeout(this.lookupRegistry(user, fileID), 2000)]; | ||
case 3: | ||
result = (_a.sent()); | ||
existing = result[1]; | ||
existing = _a.sent(); | ||
return [3 /*break*/, 5]; | ||
@@ -108,0 +107,0 @@ case 4: |
@@ -18,5 +18,6 @@ export declare const defaultSkynetPortalUrl = "https://siasky.net"; | ||
export declare function randomNumber(low: number, high: number): number; | ||
export declare function timeout(ms: number): Promise<unknown>; | ||
export declare function promiseTimeout(promise: any, ms: number): Promise<any>; | ||
export declare function stringToUint8Array(str: string): Uint8Array; | ||
export declare function hexToUint8Array(str: string): Uint8Array; | ||
export declare function readData(file: File): Promise<string | ArrayBuffer>; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -49,3 +49,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.hexToUint8Array = exports.stringToUint8Array = exports.timeout = exports.randomNumber = exports.trimUriPrefix = exports.parseSkylink = exports.makeUrl = exports.getRootDirectory = exports.getRelativeFilePath = exports.defaultPortalUrl = exports.defaultOptions = exports.addUrlQuery = exports.uriSkynetPrefix = exports.uriHandshakeResolverPrefix = exports.uriHandshakePrefix = exports.defaultSkynetPortalUrl = void 0; | ||
exports.readData = exports.hexToUint8Array = exports.stringToUint8Array = exports.promiseTimeout = exports.randomNumber = exports.trimUriPrefix = exports.parseSkylink = exports.makeUrl = exports.getRootDirectory = exports.getRelativeFilePath = exports.defaultPortalUrl = exports.defaultOptions = exports.addUrlQuery = exports.uriSkynetPrefix = exports.uriHandshakeResolverPrefix = exports.uriHandshakePrefix = exports.defaultSkynetPortalUrl = void 0; | ||
var path_browserify_1 = __importDefault(require("path-browserify")); | ||
@@ -151,14 +151,16 @@ var url_parse_1 = __importDefault(require("url-parse")); | ||
exports.randomNumber = randomNumber; | ||
function timeout(ms) { | ||
function promiseTimeout(promise, ms) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var timeout; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
setTimeout(function () { | ||
resolve(null); | ||
}, ms); | ||
})]; | ||
timeout = new Promise(function (resolve, reject) { | ||
setTimeout(function () { | ||
reject("Timed out after " + ms + "ms"); | ||
}, ms); | ||
}); | ||
return [2 /*return*/, Promise.race([promise, timeout])]; | ||
}); | ||
}); | ||
} | ||
exports.timeout = timeout; | ||
exports.promiseTimeout = promiseTimeout; | ||
// stringToUint8Array converts a string to a uint8 array | ||
@@ -174,1 +176,12 @@ function stringToUint8Array(str) { | ||
exports.hexToUint8Array = hexToUint8Array; | ||
// readData is a helper function that uses a FileReader to read the contents of | ||
// the given file | ||
function readData(file) { | ||
return new Promise(function (resolve, reject) { | ||
var reader = new FileReader(); | ||
reader.readAsDataURL(file); | ||
reader.onload = function () { return resolve(reader.result); }; | ||
reader.onerror = function (error) { return reject(error); }; | ||
}); | ||
} | ||
exports.readData = readData; |
{ | ||
"name": "skynet-js", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Sia Skynet Javascript Client", | ||
@@ -17,2 +17,3 @@ "main": "dist/index.js", | ||
"jest": { | ||
"testTimeout": 60000, | ||
"clearMocks": true, | ||
@@ -19,0 +20,0 @@ "rootDir": "src" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
78560
1274
0