num-client
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -38,13 +38,2 @@ "use strict"; | ||
}; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -262,24 +251,13 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var uv, _a, _b, k, enhancedModl; | ||
var e_3, _c; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
var uv, enhancedModl; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
uv = ''; | ||
try { | ||
for (_a = __values(userVariables.keys()), _b = _a.next(); !_b.done; _b = _a.next()) { | ||
k = _b.value; | ||
uv += k + "=" + userVariables.get(k) + ";"; | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (_b && !_b.done && (_c = _a.return)) _c.call(_a); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
userVariables.forEach(function (v, k) { | ||
uv += k + "=" + v + ";"; | ||
}); | ||
enhancedModl = "" + uv + MODULE_PREFIX + port.n + MODULE_SUFFIX + ";" + modl; | ||
return [4, this.modlServices.interpretNumRecord(enhancedModl, INTERPRETER_TIMEOUT_MS)]; | ||
case 1: return [2, _d.sent()]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
@@ -286,0 +264,0 @@ }); |
@@ -38,33 +38,2 @@ "use strict"; | ||
}; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -88,3 +57,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
DnsServicesImpl.prototype.rebuildTxtRecordContent = function (records) { | ||
var e_1, _a, e_2, _b; | ||
var ordered = new Map(); | ||
@@ -94,48 +62,39 @@ if (records) { | ||
var skipped = 0; | ||
try { | ||
for (var records_1 = __values(records), records_1_1 = records_1.next(); !records_1_1.done; records_1_1 = records_1.next()) { | ||
var data = records_1_1.value; | ||
if (MATCH_MULTIPART_RECORD_FRAGMENT.test(data)) { | ||
var pipeIndex = data.indexOf('|'); | ||
if (pipeIndex >= 0) { | ||
var parts = [data.substring(0, pipeIndex), data.substring(pipeIndex + 1)]; | ||
var dataMinusHeader = data.substring(parts[0].length + 1); | ||
if (parts[0].includes('/')) { | ||
ordered.set(0, dataMinusHeader); | ||
var firstParts = parts[0].split('/'); | ||
if (firstParts.length === 2) { | ||
total = parseInt(firstParts[1], 10); | ||
if (isNaN(total)) { | ||
throw new exceptions_1.RrSetHeaderFormatException("Could not parse total parts " + firstParts[1]); | ||
} | ||
for (var _i = 0, records_1 = records; _i < records_1.length; _i++) { | ||
var data = records_1[_i]; | ||
if (MATCH_MULTIPART_RECORD_FRAGMENT.test(data)) { | ||
var pipeIndex = data.indexOf('|'); | ||
if (pipeIndex >= 0) { | ||
var parts = [data.substring(0, pipeIndex), data.substring(pipeIndex + 1)]; | ||
var dataMinusHeader = data.substring(parts[0].length + 1); | ||
if (parts[0].includes('/')) { | ||
ordered.set(0, dataMinusHeader); | ||
var firstParts = parts[0].split('/'); | ||
if (firstParts.length === 2) { | ||
total = parseInt(firstParts[1], 10); | ||
if (isNaN(total)) { | ||
throw new exceptions_1.RrSetHeaderFormatException("Could not parse total parts " + firstParts[1]); | ||
} | ||
else { | ||
throw new exceptions_1.RrSetHeaderFormatException('First part should only contain 1 "/", format is incorrect!'); | ||
} | ||
} | ||
else { | ||
var index = parseInt(parts[0], 10); | ||
if (isNaN(index)) { | ||
throw new exceptions_1.RrSetHeaderFormatException("Could not parse index " + parts[0]); | ||
} | ||
ordered.set(index - 1, dataMinusHeader); | ||
throw new exceptions_1.RrSetHeaderFormatException('First part should only contain 1 "/", format is incorrect!'); | ||
} | ||
} | ||
} | ||
else { | ||
if (records.length === 1) { | ||
ordered.set(0, data); | ||
} | ||
else { | ||
skipped++; | ||
var index = parseInt(parts[0], 10); | ||
if (isNaN(index)) { | ||
throw new exceptions_1.RrSetHeaderFormatException("Could not parse index " + parts[0]); | ||
} | ||
ordered.set(index - 1, dataMinusHeader); | ||
} | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (records_1_1 && !records_1_1.done && (_a = records_1.return)) _a.call(records_1); | ||
else { | ||
if (records.length === 1) { | ||
ordered.set(0, data); | ||
} | ||
else { | ||
skipped++; | ||
} | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
@@ -148,18 +107,9 @@ if (total !== records.length - skipped) { | ||
} | ||
var sortedKeys = __spread(ordered.keys()).sort(function (a, b) { return a - b; }); | ||
var buffer = ''; | ||
try { | ||
for (var sortedKeys_1 = __values(sortedKeys), sortedKeys_1_1 = sortedKeys_1.next(); !sortedKeys_1_1.done; sortedKeys_1_1 = sortedKeys_1.next()) { | ||
var k = sortedKeys_1_1.value; | ||
buffer += ordered.get(k); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (sortedKeys_1_1 && !sortedKeys_1_1.done && (_b = sortedKeys_1.return)) _b.call(sortedKeys_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return buffer; | ||
var sortedKeys = Array.from(ordered.keys()); | ||
sortedKeys.sort(function (a, b) { return a - b; }); | ||
var buffer_1 = ''; | ||
sortedKeys.forEach(function (k) { | ||
buffer_1 += ordered.get(k); | ||
}); | ||
return buffer_1; | ||
} | ||
@@ -166,0 +116,0 @@ return ''; |
"use strict"; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -17,3 +6,2 @@ exports.resolvePath = void 0; | ||
function resolvePath(base, redirect) { | ||
var e_1, _a; | ||
var SEP = '/'; | ||
@@ -29,25 +17,16 @@ var basePath = base.endsWith(SEP) ? base.substr(0, base.length - 1) : base; | ||
var pathStack = new Array(); | ||
try { | ||
for (var parts_1 = __values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) { | ||
var part = parts_1_1.value; | ||
if (part === '..') { | ||
if (pathStack.length === 0) { | ||
throw new exceptions_1.RelativePathException('Cannot redirect beyond root'); | ||
} | ||
pathStack.pop(); | ||
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { | ||
var part = parts_1[_i]; | ||
if (part === '..') { | ||
if (pathStack.length === 0) { | ||
throw new exceptions_1.RelativePathException('Cannot redirect beyond root'); | ||
} | ||
else if (part !== '.') { | ||
if (part.length > 0) { | ||
pathStack.push(part); | ||
} | ||
pathStack.pop(); | ||
} | ||
else if (part !== '.') { | ||
if (part.length > 0) { | ||
pathStack.push(part); | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return SEP + pathStack.join(SEP); | ||
@@ -54,0 +33,0 @@ } |
@@ -306,5 +306,6 @@ // Copyright 2020 NUM Technology Ltd | ||
let uv = ''; | ||
for (const k of userVariables.keys()) { | ||
uv += `${k}=${userVariables.get(k)};`; | ||
} | ||
userVariables.forEach((v, k) => { | ||
uv += `${k}=${v};`; | ||
}); | ||
const enhancedModl = `${uv}${MODULE_PREFIX}${port.n}${MODULE_SUFFIX};${modl}`; | ||
@@ -311,0 +312,0 @@ return await this.modlServices.interpretNumRecord(enhancedModl, INTERPRETER_TIMEOUT_MS); |
@@ -119,7 +119,11 @@ // Copyright 2020 NUM Technology Ltd | ||
const sortedKeys = [...ordered.keys()].sort((a, b) => a - b); | ||
const sortedKeys = Array.from(ordered.keys()); | ||
sortedKeys.sort((a, b) => a - b); | ||
let buffer = ''; | ||
for (const k of sortedKeys) { | ||
sortedKeys.forEach((k) => { | ||
buffer += ordered.get(k); | ||
} | ||
}); | ||
return buffer; | ||
@@ -126,0 +130,0 @@ } |
{ | ||
"name": "num-client", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "A NUM Protocol Client in TypeScript", | ||
@@ -5,0 +5,0 @@ "types": "index.d.ts", |
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
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
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
220788
52
4331