From ff71de8f6c223ef06a737c285957caada5e4ec04 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 25 May 2016 07:06:06 +0200 Subject: [PATCH] improve domain string handling --- dist/cflare.classes.cflareaccount.js | 3 ++- package.json | 4 ++-- ts/cflare.classes.cflareaccount.ts | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dist/cflare.classes.cflareaccount.js b/dist/cflare.classes.cflareaccount.js index 2b9fe38..5e50777 100644 --- a/dist/cflare.classes.cflareaccount.js +++ b/dist/cflare.classes.cflareaccount.js @@ -31,6 +31,7 @@ var CflareAccount = (function () { }; CflareAccount.prototype.getRecord = function (domainNameArg, typeArg) { var done = plugins.q.defer(); + var domain = new plugins.smartstring.Domain(domainNameArg); this.listRecords(domainNameArg) .then(function (responseArg) { var filteredResponse = responseArg.result.filter(function (recordArg) { @@ -135,4 +136,4 @@ var CflareAccount = (function () { exports.CflareAccount = CflareAccount; ; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5jbGFzc2VzLmNmbGFyZWFjY291bnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFPLE9BQU8sV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRzdDO0lBTUk7SUFFQSxDQUFDO0lBTE8saUNBQVMsR0FBakI7UUFDSSxNQUFNLENBQUMsQ0FBQyxJQUFJLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLDRCQUE0QjtJQUN6RSxDQUFDOztJQUlELDRCQUFJLEdBQUosVUFBSyxVQUFvQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxLQUFLLENBQUM7UUFDbEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsR0FBRy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yhkb21haW5OYW1lKVxyXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcclxuICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJlZFJlc3BvbnNlID0gcmVzcG9uc2VBcmcucmVzdWx0LmZpbHRlcigoem9uZUFyZyk9PntcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gem9uZUFyZy5uYW1lID09PSBkb21haW5OYW1lO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsdGVyZWRSZXNwb25zZS5sZW5ndGggPj0gMSl7XHJcbiAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKGZpbHRlcmVkUmVzcG9uc2VbMF0uaWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcInRoZSBkb21haW4gXCIgKyBkb21haW5OYW1lLmJsdWUgKyBcIiBkb2VzIG5vdCBhcHBlYXIgdG8gYmUgaW4gdGhpcyBhY2NvdW50IVwiKTtcclxuICAgICAgICAgICAgICAgICAgICBkb25lLnJlamVjdCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4gICAgfVxyXG4gICAgZ2V0UmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIHRoaXMubGlzdFJlY29yZHMoZG9tYWluTmFtZUFyZylcclxuICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBsZXQgZmlsdGVyZWRSZXNwb25zZSA9IHJlc3BvbnNlQXJnLnJlc3VsdC5maWx0ZXIoKHJlY29yZEFyZykgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAocmVjb3JkQXJnLnR5cGUgPT0gdHlwZUFyZyAmJiByZWNvcmRBcmcubmFtZSA9PSBkb21haW5OYW1lQXJnKTsgXHJcbiAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICB9KVxyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgY3JlYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLGNvbnRlbnRBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XHJcbiAgICAgICAgbGV0IHpvbmVOYW1lOnN0cmluZyA9IGRvbWFpbi5sZXZlbDIgKyBcIi5cIiArIGRvbWFpbi5sZXZlbDE7XHJcbiAgICAgICAgdGhpcy5nZXRab25lSWQoem9uZU5hbWUpXHJcbiAgICAgICAgICAgIC50aGVuKChkb21haW5JZEFyZyk9PntcclxuICAgICAgICAgICAgICAgIGxldCBkYXRhT2JqZWN0ID0ge1xyXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IGRvbWFpbi5mdWxsTmFtZSxcclxuICAgICAgICAgICAgICAgICAgICB0eXBlOiB0eXBlQXJnLFxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnRBcmdcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICB0aGlzLnJlcXVlc3QoXCJQT1NUXCIsXCIvem9uZXMvXCIgKyBkb21haW5JZEFyZyArIFwiL2Ruc19yZWNvcmRzXCIsZGF0YU9iamVjdClcclxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgcmVtb3ZlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XHJcbiAgICAgICAgbGV0IHpvbmVOYW1lID0gZG9tYWluLmxldmVsMiArIFwiLlwiICsgZG9tYWluLmxldmVsMTtcclxuICAgICAgICB0aGlzLmxpc3RSZWNvcmRzKHpvbmVOYW1lKVxyXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcclxuICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJlZFJlc3BvbnNlID0gcmVzcG9uc2VBcmc7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgdXBkYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLHZhbHVlQXJnKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgbGlzdFJlY29yZHMoZG9tYWluTmFtZUFyZzpzdHJpbmcpe1xyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgdGhpcy5nZXRab25lSWQoZG9tYWluTmFtZUFyZylcclxuICAgICAgICAgICAgLnRoZW4oKGRvbWFpbklkQXJnKT0+e1xyXG4gICAgICAgICAgICAgICAgdGhpcy5yZXF1ZXN0KFwiR0VUXCIsXCIvem9uZXMvXCIgKyBkb21haW5JZEFyZyArIFwiL2Ruc19yZWNvcmRzP3Blcl9wYWdlPTEwMFwiKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlQXJnKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxuICAgIH1cclxuICAgIGxpc3Rab25lcyhkb21haW5OYW1lPzpzdHJpbmcpeyAvLyBUT0RPOiBoYW5kbGUgcGFnaW5hdGlvblxyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgbGV0IHJlcXVlc3RSb3V0ZSA9IFwiL3pvbmVzP3Blcl9wYWdlPTUwXCJcclxuICAgICAgICBpZihkb21haW5OYW1lKSByZXF1ZXN0Um91dGUgPSByZXF1ZXN0Um91dGUgKyBcIiZuYW1lPVwiICsgZG9tYWluTmFtZTtcclxuICAgICAgICBsZXQgcmVzdWx0ID0ge307IFxyXG4gICAgICAgIHRoaXMucmVxdWVzdChcIkdFVFwiLHJlcXVlc3RSb3V0ZSlcclxuICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xyXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gcmVzcG9uc2VBcmc7XHJcbiAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUocmVzdWx0KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxuICAgIH07XHJcbiAgICByZXF1ZXN0KG1ldGhvZEFyZzpzdHJpbmcscm91dGVBcmc6c3RyaW5nLGRhdGFBcmcgPSB7fSl7XHJcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgICAgICBsZXQganNvbkFyZzpzdHJpbmcgPSBKU09OLnN0cmluZ2lmeShkYXRhQXJnKTtcclxuICAgICAgICBsZXQgb3B0aW9ucyA9IHtcclxuICAgICAgICAgICAgbWV0aG9kOm1ldGhvZEFyZyxcclxuICAgICAgICAgICAgdXJsOlwiaHR0cHM6Ly9hcGkuY2xvdWRmbGFyZS5jb20vY2xpZW50L3Y0XCIgKyByb3V0ZUFyZyxcclxuICAgICAgICAgICAgaGVhZGVyczp7XHJcbiAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOlwiYXBwbGljYXRpb24vanNvblwiLFxyXG4gICAgICAgICAgICAgICAgXCJYLUF1dGgtRW1haWxcIjp0aGlzLmF1dGhFbWFpbCxcclxuICAgICAgICAgICAgICAgIFwiWC1BdXRoLUtleVwiOnRoaXMuYXV0aEtleVxyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBib2R5Ompzb25BcmdcclxuICAgICAgICB9O1xyXG4gICAgICAgIHBsdWdpbnMucmVxdWVzdChvcHRpb25zLGZ1bmN0aW9uKGVyciwgcmVzLCBib2R5KXtcclxuICAgICAgICAgICAgaWYgKCFlcnIgJiYgcmVzLnN0YXR1c0NvZGUgPT0gMjAwKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgcmVzcG9uc2VPYmogPSBKU09OLnBhcnNlKGJvZHkpO1xyXG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlT2JqKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXMpO1xyXG4gICAgICAgICAgICAgICAgZG9u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AgICAgICAgICAgIGlmIChmaWx0ZXJlZFJlc3BvbnNlLmxlbmd0aCA+PSAxKXtcclxuICAgICAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUoZmlsdGVyZWRSZXNwb25zZVswXS5pZCk7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmVycm9yKFwidGhlIGRvbWFpbiBcIiArIGRvbWFpbk5hbWUuYmx1ZSArIFwiIGRvZXMgbm90IGFwcGVhciB0byBiZSBpbiB0aGlzIGFjY291bnQhXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KHVuZGVmaW5lZCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9XHJcbiAgICBnZXRSZWNvcmQoZG9tYWluTmFtZUFyZzpzdHJpbmcsdHlwZUFyZzpzdHJpbmcpe1xyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgbGV0IGRvbWFpbiA9IG5ldyBwbHVnaW5zLnNtYXJ0c3RyaW5nLkRvbWFpbihkb21haW5OYW1lQXJnKTtcclxuICAgICAgICB0aGlzLmxpc3RSZWNvcmRzKGRvbWFpbk5hbWVBcmcpXHJcbiAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZykgPT4ge1xyXG4gICAgICAgICAgICAgICAgbGV0IGZpbHRlcmVkUmVzcG9uc2UgPSByZXNwb25zZUFyZy5yZXN1bHQuZmlsdGVyKChyZWNvcmRBcmcpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHJlY29yZEFyZy50eXBlID09IHR5cGVBcmcgJiYgcmVjb3JkQXJnLm5hbWUgPT0gZG9tYWluTmFtZUFyZyk7IFxyXG4gICAgICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgfSlcclxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4gICAgfTtcclxuICAgIGNyZWF0ZVJlY29yZChkb21haW5OYW1lQXJnOnN0cmluZyx0eXBlQXJnOnN0cmluZyxjb250ZW50QXJnOnN0cmluZyl7XHJcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgICAgICBsZXQgZG9tYWluID0gbmV3IHBsdWdpbnMuc21hcnRzdHJpbmcuRG9tYWluKGRvbWFpbk5hbWVBcmcpO1xyXG4gICAgICAgIGxldCB6b25lTmFtZTpzdHJpbmcgPSBkb21haW4ubGV2ZWwyICsgXCIuXCIgKyBkb21haW4ubGV2ZWwxO1xyXG4gICAgICAgIHRoaXMuZ2V0Wm9uZUlkKHpvbmVOYW1lKVxyXG4gICAgICAgICAgICAudGhlbigoZG9tYWluSWRBcmcpPT57XHJcbiAgICAgICAgICAgICAgICBsZXQgZGF0YU9iamVjdCA9IHtcclxuICAgICAgICAgICAgICAgICAgICBuYW1lOiBkb21haW4uZnVsbE5hbWUsXHJcbiAgICAgICAgICAgICAgICAgICAgdHlwZTogdHlwZUFyZyxcclxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50QXJnXHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgdGhpcy5yZXF1ZXN0KFwiUE9TVFwiLFwiL3pvbmVzL1wiICsgZG9tYWluSWRBcmcgKyBcIi9kbnNfcmVjb3Jkc1wiLGRhdGFPYmplY3QpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUocmVzcG9uc2VBcmcpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4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cGFnZT0xMDBcIilcclxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9XHJcbiAgICBsaXN0Wm9uZXMoZG9tYWluTmFtZT86c3RyaW5nKXsgLy8gVE9ETzogaGFuZGxlIHBhZ2luYXRpb25cclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIGxldCByZXF1ZXN0Um91dGUgPSBcIi96b25lcz9wZXJfcGFnZT01MFwiXHJcbiAgICAgICAgaWYoZG9tYWluTmFtZSkgcmVxdWVzdFJvdXRlID0gcmVxdWVzdFJvdXRlICsgXCImbmFtZT1cIiArIGRvbWFpbk5hbWU7XHJcbiAgICAgICAgbGV0IHJlc3VsdCA9IHt9OyBcclxuICAgICAgICB0aGlzLnJlcXVlc3QoXCJHRVRcIixyZXF1ZXN0Um91dGUpXHJcbiAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHJlc3BvbnNlQXJnO1xyXG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3VsdCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgcmVxdWVzdChtZXRob2RBcmc6c3RyaW5nLHJvdXRlQXJnOnN0cmluZyxkYXRhQXJnID0ge30pe1xyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgbGV0IGpzb25Bcmc6c3RyaW5nID0gSlNPTi5zdHJpbmdpZnkoZGF0YUFyZyk7XHJcbiAgICAgICAgbGV0IG9wdGlvbnMgPSB7XHJcbiAgICAgICAgICAgIG1ldGhvZDptZXRob2RBcmcsXHJcbiAgICAgICAgICAgIHVybDpcImh0dHBzOi8vYXBpLmNsb3VkZmxhcmUuY29tL2NsaWVudC92NFwiICsgcm91dGVBcmcsXHJcbiAgICAgICAgICAgIGhlYWRlcnM6e1xyXG4gICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjpcImFwcGxpY2F0aW9uL2pzb25cIixcclxuICAgICAgICAgICAgICAgIFwiWC1BdXRoLUVtYWlsXCI6dGhpcy5hdXRoRW1haWwsXHJcbiAgICAgICAgICAgICAgICBcIlgtQXV0aC1LZXlcIjp0aGlzLmF1dGhLZXlcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgYm9keTpqc29uQXJnXHJcbiAgICAgICAgfTtcclxuICAgICAgICBwbHVnaW5zLnJlcXVlc3Qob3B0aW9ucyxmdW5jdGlvbihlcnIsIHJlcywgYm9keSl7XHJcbiAgICAgICAgICAgIGlmICghZXJyICYmIHJlcy5zdGF0dXNDb2RlID09IDIwMCkge1xyXG4gICAgICAgICAgICAgICAgdmFyIHJlc3BvbnNlT2JqID0gSlNPTi5wYXJzZShib2R5KTtcclxuICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZU9iaik7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xyXG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzKTtcclxuICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KGVycik7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxuICAgIH1cclxufTsiXX0= diff --git a/package.json b/package.json index 637e090..f4147e5 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "beautylog": "^5.0.6", "q": "^1.4.1", "request": "^2.72.0", - "smartstring": "^2.0.0", + "smartstring": "^2.0.1", "typings-global": "^1.0.3" }, "devDependencies": { - "npmts": "^5.1.13", + "npmts": "^5.1.14", "should": "^8.4.0", "typings-test": "^1.0.1" } diff --git a/ts/cflare.classes.cflareaccount.ts b/ts/cflare.classes.cflareaccount.ts index 86759fd..e17f47c 100644 --- a/ts/cflare.classes.cflareaccount.ts +++ b/ts/cflare.classes.cflareaccount.ts @@ -34,7 +34,7 @@ export class CflareAccount { getRecord(domainNameArg:string,typeArg:string){ let done = plugins.q.defer(); let domain = new plugins.smartstring.Domain(domainNameArg); - this.listRecords(domainNameArg) + this.listRecords(domain.zoneName) .then((responseArg) => { let filteredResponse = responseArg.result.filter((recordArg) => { return (recordArg.type == typeArg && recordArg.name == domainNameArg); @@ -45,8 +45,7 @@ export class CflareAccount { createRecord(domainNameArg:string,typeArg:string,contentArg:string){ let done = plugins.q.defer(); let domain = new plugins.smartstring.Domain(domainNameArg); - let zoneName:string = domain.level2 + "." + domain.level1; - this.getZoneId(zoneName) + this.getZoneId(domain.zoneName) .then((domainIdArg)=>{ let dataObject = { name: domain.fullName, @@ -63,20 +62,21 @@ export class CflareAccount { removeRecord(domainNameArg:string,typeArg:string){ let done = plugins.q.defer(); let domain = new plugins.smartstring.Domain(domainNameArg); - let zoneName = domain.level2 + "." + domain.level1; - this.listRecords(zoneName) + this.getRecord(domain.zoneName,typeArg) .then((responseArg) => { - let filteredResponse = responseArg; + }); return done.promise; }; updateRecord(domainNameArg:string,typeArg:string,valueArg){ let done = plugins.q.defer(); + let domain = new plugins.smartstring.Domain(domainNameArg); return done.promise; }; listRecords(domainNameArg:string){ let done = plugins.q.defer(); - this.getZoneId(domainNameArg) + let domain = new plugins.smartstring.Domain(domainNameArg); + this.getZoneId(domain.zoneName) .then((domainIdArg)=>{ this.request("GET","/zones/" + domainIdArg + "/dns_records?per_page=100") .then(function(responseArg){