@unstoppabledomains/resolution
Advanced tools
Comparing version 1.16.0 to 1.16.1
import { Response as FetchResponse } from 'node-fetch'; | ||
export default abstract class BaseConnection { | ||
protected isNode(): boolean; | ||
protected getEnv(): "NODE" | "BROWSER"; | ||
protected fetch(url: string, options: { | ||
@@ -5,0 +6,0 @@ body?: string; |
@@ -58,2 +58,5 @@ "use strict"; | ||
}; | ||
BaseConnection.prototype.getEnv = function () { | ||
return this.isNode() ? "NODE" : "BROWSER"; | ||
}; | ||
BaseConnection.prototype.fetch = function (url, options) { | ||
@@ -60,0 +63,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -162,8 +162,17 @@ #!/usr/bin/env node | ||
}); }); }, response, 'gundbPk'); }, | ||
all: function () { return cli_helpers_js_1.tryInfo(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, resolution.allRecords(domain)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); }); }, response, 'records'); }, | ||
all: function () { return cli_helpers_js_1.tryInfo(function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var records; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, resolution.allRecords(domain)]; | ||
case 1: | ||
records = _a.sent(); | ||
Object.entries(records).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
return (key && !value) && (delete records[key]); | ||
}); | ||
return [2 /*return*/, records]; | ||
} | ||
}); | ||
}); }, response, 'records'); }, | ||
twitter: function () { return cli_helpers_js_1.tryInfo(function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) { | ||
@@ -170,0 +179,0 @@ switch (_b.label) { |
@@ -116,11 +116,21 @@ "use strict"; | ||
error_1 = _a.sent(); | ||
if (error_1 instanceof node_fetch_1.FetchError) { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.NamingServiceDown, { | ||
method: this.name, | ||
}); | ||
switch (this.getEnv()) { | ||
case "NODE": { | ||
if (error_1 instanceof node_fetch_1.FetchError) { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.NamingServiceDown, { | ||
method: this.name, | ||
}); | ||
} | ||
break; | ||
} | ||
case "BROWSER": { | ||
if (error_1.name === "TypeError") { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.NamingServiceDown, { | ||
method: this.name, | ||
}); | ||
} | ||
break; | ||
} | ||
} | ||
else { | ||
throw error_1; | ||
} | ||
return [3 /*break*/, 4]; | ||
throw error_1; | ||
case 4: return [2 /*return*/]; | ||
@@ -127,0 +137,0 @@ } |
@@ -167,5 +167,3 @@ "use strict"; | ||
var value = (values instanceof Array ? values[index] : values === null || values === void 0 ? void 0 : values[key]) || ''; | ||
if (value) { | ||
records[key] = value; | ||
} | ||
records[key] = value; | ||
}); | ||
@@ -172,0 +170,0 @@ return records; |
{ | ||
"name": "@unstoppabledomains/resolution", | ||
"version": "1.15.0", | ||
"version": "1.16.0", | ||
"description": "Domain Resolution for blockchain domains", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -0,1 +1,5 @@ | ||
## 1.16.1 | ||
* Fixed Fetch error display when used in browser env | ||
## 1.16.0 | ||
* Fixed bug with infura.com -> infura.io | ||
## 1.12.0 | ||
@@ -2,0 +6,0 @@ * Introduced Resolution#usdt(domain: string, version: TickerVersion) which resolves in various USDT records from different chains |
{ | ||
"name": "@unstoppabledomains/resolution", | ||
"version": "1.16.0", | ||
"version": "1.16.1", | ||
"description": "Domain Resolution for blockchain domains", | ||
@@ -5,0 +5,0 @@ "main": "./build/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
368327
9309