Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

num-client

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

num-client - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

55

dist/client.js

@@ -56,3 +56,3 @@ "use strict";

var resourceloader_1 = require("./resourceloader");
var pino_1 = __importDefault(require("pino"));
var num_easy_log_1 = require("num-easy-log");
exports.createClient = function (resolvers) { return new NumClientImpl(resolvers); };

@@ -76,3 +76,2 @@ exports.lookup = function (uri) {

var DEFAULT_RESOLVERS = [new dnsclient_1.DoHResolver('Cloudflare', 'https://cloudflare-dns.com/dns-query'), new dnsclient_1.DoHResolver('Google', 'https://dns.google.com/resolve')];
var log = pino_1.default();
var DefaultCallbackHandler = (function () {

@@ -157,3 +156,3 @@ function DefaultCallbackHandler() {

if (json) {
log.debug("json = " + json);
num_easy_log_1.log.debug("json = " + json);
if (handler) {

@@ -164,3 +163,3 @@ handler.setResult(json);

else {
log.debug('json = null');
num_easy_log_1.log.debug('json = null');
}

@@ -174,3 +173,3 @@ return [2, json];

if (e_1 instanceof exceptions_1.NumProtocolException) {
log.error("NumProtocolException: " + e_1.errorCode + " : " + e_1.message);
num_easy_log_1.log.error("NumProtocolException: " + e_1.errorCode + " : " + e_1.message);
handler === null || handler === void 0 ? void 0 : handler.setErrorCode(e_1.errorCode);

@@ -180,3 +179,3 @@ return [2, null];

else if (e_1 instanceof exceptions_1.NumMaximumRedirectsExceededException) {
log.warn('Too many redirects. Aborting the lookup.');
num_easy_log_1.log.warn('Too many redirects. Aborting the lookup.');
ctx.result = null;

@@ -192,3 +191,3 @@ ctx.location = context_1.NumLocation.none;

else if (e_1 instanceof exceptions_1.NumLookupEmptyResult) {
log.warn('Empty result');
num_easy_log_1.log.warn('Empty result');
ctx.result = null;

@@ -200,3 +199,3 @@ ctx.location = context_1.NumLocation.none;

else if (e_1 instanceof exceptions_1.NumLookupBadDoHResponse) {
log.warn('Bad DoH Service');
num_easy_log_1.log.warn('Bad DoH Service');
ctx.location = context_1.NumLocation.none;

@@ -207,3 +206,3 @@ handler === null || handler === void 0 ? void 0 : handler.setErrorCode(exceptions_1.NumProtocolErrorCode.badDoHResponse);

else if (e_1 instanceof Error) {
log.warn("Unhandled exception: " + e_1.message);
num_easy_log_1.log.warn("Unhandled exception: " + e_1.message);
ctx.location = context_1.NumLocation.none;

@@ -247,3 +246,3 @@ handler === null || handler === void 0 ? void 0 : handler.setErrorCode(exceptions_1.NumProtocolErrorCode.noModlRecordFound);

if (handler) {
log.error("NumProtocolException: " + e_2.errorCode + " : " + e_2.message);
num_easy_log_1.log.error("NumProtocolException: " + e_2.errorCode + " : " + e_2.message);
handler.setErrorCode(e_2.errorCode);

@@ -254,3 +253,3 @@ return [2, null];

else if (e_2 instanceof exceptions_1.NumMaximumRedirectsExceededException) {
log.warn('Too many redirects. Aborting the lookup.');
num_easy_log_1.log.warn('Too many redirects. Aborting the lookup.');
ctx.result = null;

@@ -268,3 +267,3 @@ ctx.location = context_1.NumLocation.none;

else if (e_2 instanceof Error) {
log.warn("Unhandled exception: " + e_2.message);
num_easy_log_1.log.warn("Unhandled exception: " + e_2.message);
if (handler) {

@@ -309,3 +308,3 @@ handler.setErrorCode(exceptions_1.NumProtocolErrorCode.internalError);

if (!!sm.complete()) return [3, 3];
log.info("Checking location: '" + ctx.location + "'");
num_easy_log_1.log.info("Checking location: '" + ctx.location + "'");
return [4, query()];

@@ -318,6 +317,6 @@ case 2:

if (ctx.result) {
log.info("Lookup result: '" + ctx.result + "', location: '" + ctx.location + "'");
num_easy_log_1.log.info("Lookup result: '" + ctx.result + "', location: '" + ctx.location + "'");
}
else {
log.info("Lookup result: 'null', location: '" + ctx.location + "'");
num_easy_log_1.log.info("Lookup result: 'null', location: '" + ctx.location + "'");
}

@@ -336,3 +335,3 @@ return [2, ctx.result];

jsonResult = this.modlServices.interpretNumRecord(modl);
log.debug("Interpreter raw JSON result: " + JSON.stringify(jsonResult));
num_easy_log_1.log.debug("Interpreter raw JSON result: " + JSON.stringify(jsonResult));
if (!(moduleNumber.n !== 0)) return [3, 13];

@@ -352,3 +351,3 @@ return [4, this.configProvider.getConfig(moduleNumber)];

case 3:
log.info('Not configured to validate against the compact schema.');
num_easy_log_1.log.info('Not configured to validate against the compact schema.');
_a.label = 4;

@@ -373,6 +372,6 @@ case 4:

jsonResult = object_unpacker_1.mapper.convert(substitutionsData, jsonResult, schemaMapResponse.data);
log.debug("Object Unpacker JSON result: " + JSON.stringify(jsonResult));
num_easy_log_1.log.debug("Object Unpacker JSON result: " + JSON.stringify(jsonResult));
}
else {
log.error("Unable to load schema map defined in " + JSON.stringify(moduleConfig));
num_easy_log_1.log.error("Unable to load schema map defined in " + JSON.stringify(moduleConfig));
throw new exceptions_1.NumProtocolException(exceptions_1.NumProtocolErrorCode.noUnpackerConfigFileFound, "Could not load the configured Unpacker config file: " + schemaMapUrl);

@@ -392,7 +391,7 @@ }

case 10:
log.info('Not configured to validate against the expanded schema.');
num_easy_log_1.log.info('Not configured to validate against the expanded schema.');
_a.label = 11;
case 11: return [3, 13];
case 12:
log.error('No module config file available.');
num_easy_log_1.log.error('No module config file available.');
throw new exceptions_1.NumProtocolException(exceptions_1.NumProtocolErrorCode.moduleConfigFileNotFound, "Unable to load the module config file for module " + moduleNumber.n + " ");

@@ -477,3 +476,3 @@ case 13: return [2, JSON.stringify(jsonResult)];

msg = "Unable to load the JSON schema from : " + schemaUrl;
log.error(msg);
num_easy_log_1.log.error(msg);
throw new exceptions_1.NumProtocolException(exceptions_1.NumProtocolErrorCode.schemaNotFound, msg);

@@ -485,11 +484,11 @@ }

msg = "Cannot find the JSON schema at " + schemaUrl;
log.error(msg);
num_easy_log_1.log.error(msg);
throw new exceptions_1.NumProtocolException(exceptions_1.NumProtocolErrorCode.schemaNotFound, msg);
}
if (existingSchema(json)) {
log.info("JSON matches the schema at " + schemaUrl);
num_easy_log_1.log.info("JSON matches the schema at " + schemaUrl);
return [2, true];
}
else {
log.error("Fails to match the JSON schema at " + schemaUrl + " - data: " + JSON.stringify(json));
num_easy_log_1.log.error("Fails to match the JSON schema at " + schemaUrl + " - data: " + JSON.stringify(json));
}

@@ -526,3 +525,3 @@ return [2, false];

if (!(localeFilename === DEFAULT_LOCALE_FILE_NAME)) return [3, 2];
log.debug("Unable to load substitutions file: " + subsFileName);
num_easy_log_1.log.debug("Unable to load substitutions file: " + subsFileName);
return [2, null];

@@ -536,3 +535,3 @@ case 2: return [4, this.generateFallbackLocaleFileName(moduleConfig, language)];

if (!subsFileResponse || !subsFileResponse.data) {
log.debug("Unable to load substitutions file: " + fallbackLocale);
num_easy_log_1.log.debug("Unable to load substitutions file: " + fallbackLocale);
return [2, null];

@@ -549,3 +548,3 @@ }

if (!subsFileResponse || !subsFileResponse.data) {
log.debug("Unable to load substitutions file: " + subsFileName);
num_easy_log_1.log.debug("Unable to load substitutions file: " + subsFileName);
return [2, null];

@@ -552,0 +551,0 @@ }

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,5 +8,4 @@ exports.Context = exports.NumLocation = void 0;

var urlrelativepathresolver_1 = require("./urlrelativepathresolver");
var pino_1 = __importDefault(require("pino"));
var num_easy_log_1 = require("num-easy-log");
var MAX_NUM_REDIRECTS = 3;
var log = pino_1.default();
var NumLocation;

@@ -50,6 +46,6 @@ (function (NumLocation) {

Context.prototype.handleQueryRedirect = function (redirect) {
log.info('Query Redirected to: {}', redirect);
num_easy_log_1.log.info("Query Redirected to: " + redirect);
var redirectCount = this.incrementRedirectCount();
if (redirectCount >= MAX_NUM_REDIRECTS) {
log.debug('Maximum Redirects Exceeded. (max={})', MAX_NUM_REDIRECTS);
num_easy_log_1.log.debug("Maximum Redirects Exceeded. (max=" + MAX_NUM_REDIRECTS + ")");
throw new exceptions_1.NumMaximumRedirectsExceededException();

@@ -56,0 +52,0 @@ }

@@ -46,7 +46,6 @@ "use strict";

var exceptions_1 = require("./exceptions");
var pino_1 = __importDefault(require("pino"));
var num_easy_log_1 = require("num-easy-log");
var SERVFAIL = 2;
var NXDOMAIN = 3;
var REFUSED = 5;
var log = pino_1.default();
var DoHResolver = (function () {

@@ -73,3 +72,3 @@ function DoHResolver(name, url) {

if (this.name !== name) {
log.debug("Query " + name + " punycode " + this.name);
num_easy_log_1.log.debug("Query " + name + " punycode " + this.name);
}

@@ -88,3 +87,3 @@ }

this.axiosProxy = proxy;
log.info("DNS client configured with resolver: " + this.resolver.url);
num_easy_log_1.log.info("DNS client configured with resolver: " + this.resolver.url);
}

@@ -116,16 +115,16 @@ DnsClientImpl.prototype.setTimeout = function (t) {

case NXDOMAIN:
log.warn('Bad DNS status - NXDOMAIN');
num_easy_log_1.log.warn('Bad DNS status - NXDOMAIN');
break;
case SERVFAIL:
log.warn('Bad DNS status - SERVFAIL');
num_easy_log_1.log.warn('Bad DNS status - SERVFAIL');
break;
case REFUSED:
log.warn('Bad DNS status - REFUSED');
num_easy_log_1.log.warn('Bad DNS status - REFUSED');
break;
default:
log.warn("Error resolving " + question.name + " with " + this.resolver.name);
num_easy_log_1.log.warn("Error resolving " + question.name + " with " + this.resolver.name);
}
}
else {
log.warn("Error resolving " + question.name + " with " + this.resolver.name + ". " + JSON.stringify(err_1));
num_easy_log_1.log.warn("Error resolving " + question.name + " with " + this.resolver.name + ". " + JSON.stringify(err_1));
throw err_1;

@@ -145,3 +144,3 @@ }

case 0:
log.info("Query made using " + resolver.name + " for the DNS " + question.type + " record(s) at " + question.name + " dnssec:" + question.dnssec.toString());
num_easy_log_1.log.info("Query made using " + resolver.name + " for the DNS " + question.type + " record(s) at " + question.name + " dnssec:" + question.dnssec.toString());
params = "name=" + question.name + "&type=" + question.type + "&dnssec=" + (question.dnssec ? '1' : '0') + '&ct=application/dns-json';

@@ -154,3 +153,3 @@ url = resolver.url + "?" + params;

if (response.data.AD && question.dnssec) {
log.warn('DNSSEC checks not implemented.');
num_easy_log_1.log.warn('DNSSEC checks not implemented.');
}

@@ -164,3 +163,3 @@ switch (response.data.Status) {

if (question.name !== answerName) {
log.error("Q = " + JSON.stringify(question) + ", A = " + JSON.stringify(data[0]));
num_easy_log_1.log.error("Q = " + JSON.stringify(question) + ", A = " + JSON.stringify(data[0]));
}

@@ -170,7 +169,7 @@ return [2, data.map(joinParts)];

else {
log.warn('Domain was resolved but the answer was empty');
num_easy_log_1.log.warn('Domain was resolved but the answer was empty');
}
}
else {
log.warn('Domain was resolved but no records were found');
num_easy_log_1.log.warn('Domain was resolved but no records were found');
}

@@ -213,5 +212,5 @@ break;

.join(' ');
log.debug("Joined data " + joined);
num_easy_log_1.log.debug("Joined data " + joined);
return joined;
};
//# sourceMappingURL=dnsclient.js.map

@@ -46,5 +46,4 @@ "use strict";

var exceptions_1 = require("./exceptions");
var pino_1 = __importDefault(require("pino"));
var num_easy_log_1 = require("num-easy-log");
var MATCH_MULTIPART_RECORD_FRAGMENT = /(^\d+\|.*)|(\d+\/\d+\|@n=\d+;.*)/;
var log = pino_1.default();
exports.createDnsServices = function (timeout, resolvers, proxy) {

@@ -139,7 +138,7 @@ return new DnsServicesImpl(timeout, resolvers, proxy);

dohIndex = this.findActiveResolver(dohIndex);
log.debug("Using DoH: " + this.dnsClients[dohIndex].getResolver().name);
num_easy_log_1.log.debug("Using DoH: " + this.dnsClients[dohIndex].getResolver().name);
return [2, this.dnsClients[dohIndex]
.query(question)
.then(function (result) {
log.debug("Performed dns lookup " + JSON.stringify(question) + " and got " + JSON.stringify(result));
num_easy_log_1.log.debug("Performed dns lookup " + JSON.stringify(question) + " and got " + JSON.stringify(result));
var rebuiltModlRecord = _this.rebuildTxtRecordContent(result);

@@ -157,6 +156,6 @@ return exports.punydecode(rebuiltModlRecord);

}
log.info("The current resolver failed so disable it for a while: " + _this.dnsClients[dohIndex].getResolver().name);
num_easy_log_1.log.info("The current resolver failed so disable it for a while: " + _this.dnsClients[dohIndex].getResolver().name);
_this.dnsClients[dohIndex].getResolver().disableForSeconds(5);
dohIndex = _this.findActiveResolver(dohIndex);
log.warn("Switching to DoH: " + _this.dnsClients[dohIndex].getResolver().name + " due to " + JSON.stringify(e));
num_easy_log_1.log.warn("Switching to DoH: " + _this.dnsClients[dohIndex].getResolver().name + " due to " + JSON.stringify(e));
return _this._getRecordFromDns(query, checkDnsSecValidity, attempts - 1, dohIndex);

@@ -170,3 +169,3 @@ })];

if (this.dnsClients[dohIndex].getResolver().isActive()) {
log.info("Found an active resolver: " + this.dnsClients[dohIndex].getResolver().name);
num_easy_log_1.log.info("Found an active resolver: " + this.dnsClients[dohIndex].getResolver().name);
break;

@@ -177,3 +176,3 @@ }

if (!this.dnsClients[dohIndex].getResolver().isActive()) {
log.info("Can't find an active resolver so aborting.");
num_easy_log_1.log.info("Can't find an active resolver so aborting.");
throw new exceptions_1.NumLookupBadDoHResponse();

@@ -180,0 +179,0 @@ }

@@ -25,3 +25,3 @@ "use strict";

var numuri_1 = require("./numuri");
var pino_1 = __importDefault(require("pino"));
var num_easy_log_1 = require("num-easy-log");
var _NUM = '._num.';

@@ -35,3 +35,2 @@ var DNPREFIX = '_';

var SCHEME_REGEX = new RegExp(/^[a-zA-Z][0-9a-zA-Z+.-]+:/);
var log = pino_1.default();
exports.setenvDomainLookups = function (env) {

@@ -168,3 +167,3 @@ switch (env) {

if (_this._branch !== branch) {
log.debug("Query " + _this._branch + " punycode " + branch);
num_easy_log_1.log.debug("Query " + _this._branch + " punycode " + branch);
}

@@ -187,3 +186,3 @@ _this._numUri = _this._numUri.withHost(new numuri_1.Hostname(exports.normaliseDomainName(numUri.host.s)));

if (branch !== _this._branch) {
log.debug("Query " + branch + " punycode " + _this._branch);
num_easy_log_1.log.debug("Query " + branch + " punycode " + _this._branch);
}

@@ -208,3 +207,3 @@ return _this;

EmailLookupGeneratorImpl.prototype.getPopulatorLocation = function (moduleId) {
log.warn("getPopulatorLocation called on email with " + moduleId.n);
num_easy_log_1.log.warn("getPopulatorLocation called on email with " + moduleId.n);
return null;

@@ -254,3 +253,3 @@ };

if (branch !== _this._branch) {
log.debug("Query " + branch + " punycode " + _this._branch);
num_easy_log_1.log.debug("Query " + branch + " punycode " + _this._branch);
}

@@ -269,3 +268,3 @@ return _this;

if (_this._branch !== branch) {
log.debug("Query " + _this._branch + " punycode " + branch);
num_easy_log_1.log.debug("Query " + _this._branch + " punycode " + branch);
}

@@ -272,0 +271,0 @@ _this._numUri = _this._numUri.withHost(new numuri_1.Hostname(exports.normaliseDomainName(numUri.host.s)));

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createLookupLocationStateMachine = void 0;
var context_1 = require("./context");
var pino_1 = __importDefault(require("pino"));
var log = pino_1.default();
var num_easy_log_1 = require("num-easy-log");
exports.createLookupLocationStateMachine = function () { return new LookupLocationStateMachineImpl(); };

@@ -28,5 +24,5 @@ var LookupState;

LookupLocationStateMachineImpl.prototype.step = function (lookupResult) {
log.debug('LookupLocationStateMachine - before step: ' + this.state);
num_easy_log_1.log.debug('LookupLocationStateMachine - before step: ' + this.state);
var result = typeof lookupResult === 'boolean' && lookupResult === true ? this.success() : this.fail();
log.debug('LookupLocationStateMachine - after step: ' + this.state);
num_easy_log_1.log.debug('LookupLocationStateMachine - after step: ' + this.state);
return result;

@@ -33,0 +29,0 @@ };

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -10,4 +7,3 @@ exports.createModuleDnsQueries = void 0;

var numuri_1 = require("./numuri");
var pino_1 = __importDefault(require("pino"));
var log = pino_1.default();
var num_easy_log_1 = require("num-easy-log");
exports.createModuleDnsQueries = function (moduleId, numUri) { return new ModuleDnsQueriesImpl(moduleId, numUri); };

@@ -65,3 +61,3 @@ var ModuleDnsQueriesImpl = (function () {

else {
log.warn('Attempt to distribute a non-email lookup using a Zone Distribution Record.');
num_easy_log_1.log.warn('Attempt to distribute a non-email lookup using a Zone Distribution Record.');
}

@@ -68,0 +64,0 @@ };

@@ -45,4 +45,3 @@ "use strict";

var lrucache_1 = require("./lrucache");
var pino_1 = __importDefault(require("pino"));
var log = pino_1.default();
var num_easy_log_1 = require("num-easy-log");
exports.createResourceLoader = function () { return new ResourceLoaderImpl(); };

@@ -77,3 +76,3 @@ var ResourceLoaderImpl = (function () {

if (e instanceof Error) {
log.error("Cannot load resource from " + url + " - " + e.message);
num_easy_log_1.log.error("Cannot load resource from " + url + " - " + e.message);
}

@@ -80,0 +79,0 @@ }

{
"name": "num-client",
"version": "2.0.5",
"version": "2.0.6",
"description": "A NUM Protocol Client in TypeScript",

@@ -15,4 +15,4 @@ "main": "dist/index.js",

"delay": "^4.4.0",
"modl-interpreter": "0.0.19",
"object-unpacker": "0.0.21",
"modl-interpreter": "0.0.20",
"object-unpacker": "0.0.22",
"process": "^0.11.10",

@@ -19,0 +19,0 @@ "punycode": "^2.1.1",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc