From 757a9acd09d6c43d8e0313fb476fb416b64eab53 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 21 Jun 2016 19:04:43 +0200 Subject: [PATCH] now works for most things --- dist/cflare.classes.cflareaccount.js | 17 ++++++++++++-- package.json | 4 ++-- test/test.js | 35 +++++++++++++++++++++------- test/test.ts | 28 +++++++++++++++++----- ts/cflare.classes.cflareaccount.ts | 14 +++++++++-- 5 files changed, 77 insertions(+), 21 deletions(-) diff --git a/dist/cflare.classes.cflareaccount.js b/dist/cflare.classes.cflareaccount.js index 9751610..92ebc1c 100644 --- a/dist/cflare.classes.cflareaccount.js +++ b/dist/cflare.classes.cflareaccount.js @@ -37,6 +37,7 @@ var CflareAccount = (function () { var filteredResponse = responseArg.result.filter(function (recordArg) { return (recordArg.type == typeArg && recordArg.name == domainNameArg); }); + done.resolve(filteredResponse[0]); }); return done.promise; }; @@ -61,10 +62,21 @@ var CflareAccount = (function () { }; ; CflareAccount.prototype.removeRecord = function (domainNameArg, typeArg) { + var _this = this; var done = plugins.q.defer(); var domain = new plugins.smartstring.Domain(domainNameArg); - this.getRecord(domain.zoneName, typeArg) + this.getRecord(domain.fullName, typeArg) .then(function (responseArg) { + if (responseArg) { + var requestRoute = "/zones/" + responseArg.zone_id + "/dns_records/" + responseArg.id; + _this.request("DELETE", requestRoute) + .then(function (responseArg) { + done.resolve(responseArg); + }); + } + else { + done.reject(); + } }); return done.promise; }; @@ -116,6 +128,7 @@ var CflareAccount = (function () { }, body: jsonArg }; + //console.log(options); plugins.request(options, function (err, res, body) { if (!err && res.statusCode == 200) { var responseObj = JSON.parse(body); @@ -135,4 +148,4 @@ var CflareAccount = (function () { exports.CflareAccount = CflareAccount; ; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5jbGFzc2VzLmNmbGFyZWFjY291bnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8s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pcy5hdXRoRW1haWwgJiYgdGhpcy5hdXRoS2V5KTsgLy9jaGVjayBpZiBhdXRoIGlzIGF2YWlsYWJsZVxuICAgIH1cbiAgICBjb25zdHJ1Y3Rvcigpe1xuICAgICAgICBcbiAgICB9O1xuICAgIGF1dGgob3B0aW9uc0FyZzp7ZW1haWw6c3RyaW5nLGtleTpzdHJpbmd9KXtcbiAgICAgICAgdGhpcy5hdXRoRW1haWwgPSBvcHRpb25zQXJnLmVtYWlsO1xuICAgICAgICB0aGlzLmF1dGhLZXkgPSBvcHRpb25zQXJnLmtleTsgICAgICAgXG4gICAgfVxuICAgIGdldFpvbmVJZChkb21haW5OYW1lOnN0cmluZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIHRoaXMubGlzdFpvbmVzKGRvbWFpbk5hbWUpXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgZmlsdGVyZWRSZXNwb25zZSA9IHJlc3BvbnNlQXJnLnJlc3VsdC5maWx0ZXIoKHpvbmVBcmcpPT57XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB6b25lQXJnLm5hbWUgPT09IGRvbWFpbk5hbWU7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgaWYgKGZpbHRlcmVkUmVzcG9uc2UubGVuZ3RoID49IDEpe1xuICAgICAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUoZmlsdGVyZWRSZXNwb25zZVswXS5pZCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGx1Z2lucy5iZWF1dHlsb2cuZXJyb3IoXCJ0aGUgZG9tYWluIFwiICsgZG9tYWluTmFtZS5ibHVlICsgXCIgZG9lcyBub3QgYXBwZWFyIHRvIGJlIGluIHRoaXMgYWNjb3VudCFcIik7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KHVuZGVmaW5lZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxuICAgIGdldFJlY29yZChkb21haW5OYW1lQXJnOnN0cmluZyx0eXBlQXJnOnN0cmluZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XG4gICAgICAgIHRoaXMubGlzdFJlY29yZHMoZG9tYWluLnpvbmVOYW1lKVxuICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XG4gICAgICAgICAgICAgICAgbGV0IGZpbHRlcmVkUmVzcG9uc2UgPSByZXNwb25zZUFyZy5yZXN1bHQuZmlsdGVyKChyZWNvcmRBcmcpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChyZWNvcmRBcmcudHlwZSA9PSB0eXBlQXJnICYmIHJlY29yZEFyZy5uYW1lID09IGRvbWFpbk5hbWVBcmcpOyBcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfSlcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9O1xuICAgIGNyZWF0ZVJlY29yZChkb21haW5OYW1lQXJnOnN0cmluZyx0eXBlQXJnOnN0cmluZyxjb250ZW50QXJnOnN0cmluZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XG4gICAgICAgIHRoaXMuZ2V0Wm9uZUlkKGRvbWFpbi56b25lTmFtZSlcbiAgICAgICAgICAgIC50aGVuKChkb21haW5JZEFyZyk9PntcbiAgICAgICAgICAgICAgICBsZXQgZGF0YU9iamVjdCA9IHtcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogZG9tYWluLmZ1bGxOYW1lLFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiB0eXBlQXJnLFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50QXJnXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlcXVlc3QoXCJQT1NUXCIsXCIvem9uZXMvXCIgKyBkb21haW5JZEFyZyArIFwiL2Ruc19yZWNvcmRzXCIsZGF0YU9iamVjdClcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9O1xuICAgIHJlbW92ZVJlY29yZChkb21haW5OYW1lQXJnOnN0cmluZyx0eXBlQXJnOnN0cmluZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XG4gICAgICAgIHRoaXMuZ2V0UmVjb3JkKGRvbWFpbi56b25lTmFtZSx0eXBlQXJnKVxuICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9O1xuICAgIHVwZGF0ZVJlY29yZChkb21haW5OYW1lQXJnOnN0cmluZyx0eXBlQXJnOnN0cmluZyx2YWx1ZUFyZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfTtcbiAgICBsaXN0UmVjb3Jkcyhkb21haW5OYW1lQXJnOnN0cmluZyl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XG4gICAgICAgIHRoaXMuZ2V0Wm9uZUlkKGRvbWFpbi56b25lTmFtZSlcbiAgICAgICAgICAgIC50aGVuKChkb21haW5JZEFyZyk9PntcbiAgICAgICAgICAgICAgICB0aGlzLnJlcXVlc3QoXCJHRVRcIixcIi96b25lcy9cIiArIGRvbWFpbklkQXJnICsgXCIvZG5zX3JlY29yZHM/cGVyX3BhZ2U9MTAwXCIpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZUFyZyk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxuICAgIGxpc3Rab25lcyhkb21haW5OYW1lPzpzdHJpbmcpeyAvLyBUT0RPOiBoYW5kbGUgcGFnaW5hdGlvblxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICBsZXQgcmVxdWVzdFJvdXRlID0gXCIvem9uZXM/cGVyX3BhZ2U9NTBcIlxuICAgICAgICBpZihkb21haW5OYW1lKSByZXF1ZXN0Um91dGUgPSByZXF1ZXN0Um91dGUgKyBcIiZuYW1lPVwiICsgZG9tYWluTmFtZTtcbiAgICAgICAgbGV0IHJlc3VsdCA9IHt9OyBcbiAgICAgICAgdGhpcy5yZXF1ZXN0KFwiR0VUXCIscmVxdWVzdFJvdXRlKVxuICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHJlc3BvbnNlQXJnO1xuICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXN1bHQpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfTtcbiAgICByZXF1ZXN0KG1ldGhvZEFyZzpzdHJpbmcscm91dGVBcmc6c3RyaW5nLGRhdGFBcmcgPSB7fSl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBqc29uQXJnOnN0cmluZyA9IEpTT04uc3RyaW5naWZ5KGRhdGFBcmcpO1xuICAgICAgICBsZXQgb3B0aW9ucyA9IHtcbiAgICAgICAgICAgIG1ldGhvZDptZXRob2RBcmcsXG4gICAgICAgICAgICB1cmw6XCJodHRwczovL2FwaS5jbG91ZGZsYXJlLmNvbS9jbGllbnQvdjRcIiArIHJvdXRlQXJnLFxuICAgICAgICAgICAgaGVhZGVyczp7XG4gICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjpcImFwcGxpY2F0aW9uL2pzb25cIixcbiAgICAgICAgICAgICAgICBcIlgtQXV0aC1FbWFpbFwiOnRoaXMuYXV0aEVtYWlsLFxuICAgICAgICAgICAgICAgIFwiWC1BdXRoLUtleVwiOnRoaXMuYXV0aEtleVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGJvZHk6anNvbkFyZ1xuICAgICAgICB9O1xuICAgICAgICBwbHVnaW5zLnJlcXVlc3Qob3B0aW9ucyxmdW5jdGlvbihlcnIsIHJlcywgYm9keSl7XG4gICAgICAgICAgICBpZiAoIWVyciAmJiByZXMuc3RhdHVzQ29kZSA9PSAyMDApIHtcbiAgICAgICAgICAgICAgICB2YXIgcmVzcG9uc2VPYmogPSBKU09OLnBhcnNlKGJvZHkpO1xuICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZU9iaik7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzKTtcbiAgICAgICAgICAgICAgICBkb25lLnJlamVjdChlcnIpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxufTsiXX0= +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5jbGFzc2VzLmNmbGFyZWFjY291bnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFPLE9BQU8sV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRzdDO0lBTUk7SUFFQSxDQUFDO0lBTE8saUNBQVMsR0FBakI7UUFDSSxNQUFNLENBQUMsQ0FBQyxJQUFJLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLDRCQUE0QjtJQUN6RSxDQUFDOztJQUlELDRCQUFJLEdBQUosVUFBSyxVQUFvQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxLQUFLLENBQUM7UUFDbEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsR0FBRyxDQUFDO0lBQ2xDLENBQUM7SUFDRCxpQ0FBUyxHQUFULFVBQVUsVUFBaUI7UUFDdkIsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUM3QixJQU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nQhXCIpO1xuICAgICAgICAgICAgICAgICAgICBkb25lLnJlamVjdCh1bmRlZmluZWQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cbiAgICBnZXRSZWNvcmQoZG9tYWluTmFtZUFyZzpzdHJpbmcsdHlwZUFyZzpzdHJpbmcpe1xuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICBsZXQgZG9tYWluID0gbmV3IHBsdWdpbnMuc21hcnRzdHJpbmcuRG9tYWluKGRvbWFpbk5hbWVBcmcpO1xuICAgICAgICB0aGlzLmxpc3RSZWNvcmRzKGRvbWFpbi56b25lTmFtZSlcbiAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZykgPT4ge1xuICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJlZFJlc3BvbnNlID0gcmVzcG9uc2VBcmcucmVzdWx0LmZpbHRlcigocmVjb3JkQXJnKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAocmVjb3JkQXJnLnR5cGUgPT0gdHlwZUFyZyAmJiByZWNvcmRBcmcubmFtZSA9PSBkb21haW5OYW1lQXJnKTsgXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUoZmlsdGVyZWRSZXNwb25zZVswXSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH07XG4gICAgY3JlYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLGNvbnRlbnRBcmc6c3RyaW5nKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGRvbWFpbiA9IG5ldyBwbHVnaW5zLnNtYXJ0c3RyaW5nLkRvbWFpbihkb21haW5OYW1lQXJnKTtcbiAgICAgICAgdGhpcy5nZXRab25lSWQoZG9tYWluLnpvbmVOYW1lKVxuICAgICAgICAgICAgLnRoZW4oKGRvbWFpbklkQXJnKT0+e1xuICAgICAgICAgICAgICAgIGxldCBkYXRhT2JqZWN0ID0ge1xuICAgICAgICAgICAgICAgICAgICBuYW1lOiBkb21haW4uZnVsbE5hbWUsXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IHR5cGVBcmcsXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnRBcmdcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMucmVxdWVzdChcIlBPU1RcIixcIi96b25lcy9cIiArIGRvbWFpbklkQXJnICsgXCIvZG5zX3JlY29yZHNcIixkYXRhT2JqZWN0KVxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUocmVzcG9uc2VBcmcpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH07XG4gICAgcmVtb3ZlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGRvbWFpbiA9IG5ldyBwbHVnaW5zLnNtYXJ0c3RyaW5nLkRvbWFpbihkb21haW5OYW1lQXJnKTtcbiAgICAgICAgdGhpcy5nZXRSZWNvcmQoZG9tYWluLmZ1bGxOYW1lLHR5cGVBcmcpXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcbiAgICAgICAgICAgICAgICBpZihyZXNwb25zZUFyZyl7XG4gICAgICAgICAgICAgICAgICAgIGxldCByZXF1ZXN0Um91dGU6c3RyaW5nID0gXCIvem9uZXMvXCIgKyByZXNwb25zZUFyZy56b25lX2lkICsgXCIvZG5zX3JlY29yZHMvXCIgKyByZXNwb25zZUFyZy5pZDsgXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVxdWVzdChcIkRFTEVURVwiLHJlcXVlc3RSb3V0ZSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZykgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZUFyZyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBkb25lLnJlamVjdCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH07XG4gICAgdXBkYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLHZhbHVlQXJnKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGRvbWFpbiA9IG5ldyBwbHVnaW5zLnNtYXJ0c3RyaW5nLkRvbWFpbihkb21haW5OYW1lQXJnKTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9O1xuICAgIGxpc3RSZWNvcmRzKGRvbWFpbk5hbWVBcmc6c3RyaW5nKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGRvbWFpbiA9IG5ldyBwbHVnaW5zLnNtYXJ0c3RyaW5nLkRvbWFpbihkb21haW5OYW1lQXJnKTtcbiAgICAgICAgdGhpcy5nZXRab25lSWQoZG9tYWluLnpvbmVOYW1lKVxuICAgICAgICAgICAgLnRoZW4oKGRvbWFpbklkQXJnKT0+e1xu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VnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGpzb25Bcmc6c3RyaW5nID0gSlNPTi5zdHJpbmdpZnkoZGF0YUFyZyk7XG4gICAgICAgIGxldCBvcHRpb25zID0ge1xuICAgICAgICAgICAgbWV0aG9kOm1ldGhvZEFyZyxcbiAgICAgICAgICAgIHVybDpcImh0dHBzOi8vYXBpLmNsb3VkZmxhcmUuY29tL2NsaWVudC92NFwiICsgcm91dGVBcmcsXG4gICAgICAgICAgICBoZWFkZXJzOntcbiAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOlwiYXBwbGljYXRpb24vanNvblwiLFxuICAgICAgICAgICAgICAgIFwiWC1BdXRoLUVtYWlsXCI6dGhpcy5hdXRoRW1haWwsXG4gICAgICAgICAgICAgICAgXCJYLUF1dGgtS2V5XCI6dGhpcy5hdXRoS2V5XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYm9keTpqc29uQXJnXG4gICAgICAgIH07XG4gICAgICAgIC8vY29uc29sZS5sb2cob3B0aW9ucyk7XG4gICAgICAgIHBsdWdpbnMucmVxdWVzdChvcHRpb25zLGZ1bmN0aW9uKGVyciwgcmVzLCBib2R5KXtcbiAgICAgICAgICAgIGlmICghZXJyICYmIHJlcy5zdGF0dXNDb2RlID09IDIwMCkge1xuICAgICAgICAgICAgICAgIHZhciByZXNwb25zZU9iaiA9IEpTT04ucGFyc2UoYm9keSk7XG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlT2JqKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXMpO1xuICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KGVycik7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG59OyJdfQ== diff --git a/package.json b/package.json index b6ea322..51bf942 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,12 @@ "beautylog": "^5.0.12", "q": "^1.4.1", "request": "^2.72.0", - "smartstring": "^2.0.6", + "smartstring": "^2.0.9", "typings-global": "^1.0.3" }, "devDependencies": { "npmts-g": "^5.2.6", - "qenv": "^1.0.6", + "qenv": "^1.0.8", "should": "^9.0.2", "typings-test": "^1.0.1" } diff --git a/test/test.js b/test/test.js index cb480fa..fd3111a 100644 --- a/test/test.js +++ b/test/test.js @@ -4,6 +4,7 @@ var cflare = require("../dist/index"); var should = require("should"); var qenv_1 = require("qenv"); var testQenv = new qenv_1.Qenv(process.cwd(), process.cwd() + "/.nogit"); +console.log(testQenv.missingEnvVars); var testCflareAccount = new cflare.CflareAccount(); testCflareAccount.auth({ email: process.env.CF_EMAIL, @@ -12,7 +13,7 @@ testCflareAccount.auth({ describe("cflare", function () { describe(".CflareAccount", function () { describe(".listZones()", function () { - it("should display an account", function (done) { + it("should display an entire account", function (done) { this.timeout(10000); testCflareAccount.listZones() .then(function (responseArg) { @@ -58,16 +59,32 @@ describe("cflare", function () { }); }); }); + describe(".getRecord", function () { + it("should get a record from Cloudflare", function (done) { + testCflareAccount.getRecord("bleu.de", "A") + .then(function (responseArg) { + console.log(responseArg); + done(); + }); + }); + }); describe(".removeRecord", function () { - /*it("should remove a record from Cloudflare",function(done){ - testCflareAccount.removeRecord() - .then(function(responseArg){ - console.log(responseArg); - done(); - }); - });*/ + it("should remove a record from Cloudflare", function (done) { + testCflareAccount.removeRecord("bleu.de", "A") + .then(function (responseArg) { + console.log(responseArg); + done(); + }); + }); + it("should remove a subdomain record from Cloudflare", function (done) { + testCflareAccount.removeRecord("subdomain.bleu.de", "A") + .then(function (responseArg) { + console.log(responseArg); + done(); + }); + }); }); }); }); -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBw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ZfRU1BSUwsXG4gICAga2V5OiBwcm9jZXNzLmVudi5DRl9LRVlcbn0pO1xuXG5kZXNjcmliZShcImNmbGFyZVwiLGZ1bmN0aW9uKCl7XG4gICAgZGVzY3JpYmUoXCIuQ2ZsYXJlQWNjb3VudFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgIGRlc2NyaWJlKFwiLmxpc3Rab25lcygpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGRpc3BsYXkgYW4gYWNjb3VudFwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMCk7XG4gICAgICAgICAgICAgICAgdGVzdENmbGFyZUFjY291bnQubGlzdFpvbmVzKClcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKT0+e1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi5nZXRab25lSWQoZG9tYWluTmFtZSlcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgZ2V0IGFuIENsb3VkZmxhcmUgSWQgZm9yIGEgZG9tYWluIHN0cmluZ1wiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMClcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5nZXRab25lSWQoXCJibGV1LmRlXCIpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZyk9PntcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGRlc2NyaWJlKFwiLmxpc3RSZWNvcmRzKGRvbWFpbk5hbWUpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGxpc3QgYWxsIHJlY29yZHMgZm9yIGEgc3BlY2lmaWMgRG9tYWluIE5hbWVcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50Lmxpc3RSZWNvcmRzKFwiYmxldS5kZVwiKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSlcbiAgICAgICAgZGVzY3JpYmUoXCIuY3JlYXRlUmVjb3JkXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMCk7XG4gICAgICAgICAgICBpdChcInNob3VsZCBjcmVhdGUgYSB2YWxpZCByZWNvcmQgZm9yIGEgbGV2ZWwgMiBkb21haW5cIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5jcmVhdGVSZWNvcmQoXCJibGV1LmRlXCIsXCJBXCIsXCIxMjcuMC4wLjFcIilcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgY3JlYXRlIGEgdmFsaWQgcmVjb3JkIGZvciBhIHN1YmRvbWFpblwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50LmNyZWF0ZVJlY29yZChcInN1YmRvbWFpbi5ibGV1LmRlXCIsXCJBXCIsXCIxMjcuMC4wLjFcIilcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgZGVzY3JpYmUoXCIucmVtb3ZlUmVjb3JkXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIC8qaXQoXCJzaG91bGQgcmVtb3ZlIGEgcmVjb3JkIGZyb20gQ2xvdWRmbGFyZVwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50LnJlbW92ZVJlY29yZCgpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTsqL1xuICAgICAgICB9KTtcbiAgICB9KVxufSk7XG4iXX0= +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSw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uQ0ZfRU1BSUwsXG4gICAga2V5OiBwcm9jZXNzLmVudi5DRl9LRVlcbn0pO1xuXG5kZXNjcmliZShcImNmbGFyZVwiLGZ1bmN0aW9uKCl7XG4gICAgZGVzY3JpYmUoXCIuQ2ZsYXJlQWNjb3VudFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgIGRlc2NyaWJlKFwiLmxpc3Rab25lcygpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGRpc3BsYXkgYW4gZW50aXJlIGFjY291bnRcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50Lmxpc3Rab25lcygpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZyk9PntcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgZGVzY3JpYmUoXCIuZ2V0Wm9uZUlkKGRvbWFpbk5hbWUpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGdldCBhbiBDbG91ZGZsYXJlIElkIGZvciBhIGRvbWFpbiBzdHJpbmdcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApXG4gICAgICAgICAgICAgICAgdGVzdENmbGFyZUFjY291bnQuZ2V0Wm9uZUlkKFwiYmxldS5kZVwiKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi5saXN0UmVjb3Jkcyhkb21haW5OYW1lKVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBpdChcInNob3VsZCBsaXN0IGFsbCByZWNvcmRzIGZvciBhIHNwZWNpZmljIERvbWFpbiBOYW1lXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5saXN0UmVjb3JkcyhcImJsZXUuZGVcIilcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pXG4gICAgICAgIGRlc2NyaWJlKFwiLmNyZWF0ZVJlY29yZFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgY3JlYXRlIGEgdmFsaWQgcmVjb3JkIGZvciBhIGxldmVsIDIgZG9tYWluXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICAgICAgdGVzdENmbGFyZUFjY291bnQuY3JlYXRlUmVjb3JkKFwiYmxldS5kZVwiLFwiQVwiLFwiMTI3LjAuMC4xXCIpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGNyZWF0ZSBhIHZhbGlkIHJlY29yZCBmb3IgYSBzdWJkb21haW5cIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5jcmVhdGVSZWNvcmQoXCJzdWJkb21haW4uYmxldS5kZVwiLFwiQVwiLFwiMTI3LjAuMC4xXCIpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGRlc2NyaWJlKFwiLmdldFJlY29yZFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBpdChcInNob3VsZCBnZXQgYSByZWNvcmQgZnJvbSBDbG91ZGZsYXJlXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICAgICAgdGVzdENmbGFyZUFjY291bnQuZ2V0UmVjb3JkKFwiYmxldS5kZVwiLFwiQVwiKVxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZXNjcmliZShcIi5yZW1vdmVSZWNvcmRcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcmVtb3ZlIGEgcmVjb3JkIGZyb20gQ2xvdWRmbGFyZVwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50LnJlbW92ZVJlY29yZChcImJsZXUuZGVcIixcIkFcIilcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaXQoXCJzaG91bGQgcmVtb3ZlIGEgc3ViZG9tYWluIHJlY29yZCBmcm9tIENsb3VkZmxhcmVcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5yZW1vdmVSZWNvcmQoXCJzdWJkb21haW4uYmxldS5kZVwiLFwiQVwiKVxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH0pXG59KTtcbiJdfQ== diff --git a/test/test.ts b/test/test.ts index f66cc97..dbd1afa 100644 --- a/test/test.ts +++ b/test/test.ts @@ -3,7 +3,7 @@ import cflare = require("../dist/index"); let should = require("should"); import {Qenv} from "qenv"; let testQenv = new Qenv(process.cwd(),process.cwd() + "/.nogit"); - +console.log(testQenv.missingEnvVars); let testCflareAccount = new cflare.CflareAccount(); testCflareAccount.auth({ email: process.env.CF_EMAIL, @@ -13,7 +13,7 @@ testCflareAccount.auth({ describe("cflare",function(){ describe(".CflareAccount",function(){ describe(".listZones()",function(){ - it("should display an account",function(done){ + it("should display an entire account",function(done){ this.timeout(10000); testCflareAccount.listZones() .then((responseArg)=>{ @@ -59,14 +59,30 @@ describe("cflare",function(){ }); }); }); - describe(".removeRecord",function(){ - /*it("should remove a record from Cloudflare",function(done){ - testCflareAccount.removeRecord() + describe(".getRecord",function(){ + it("should get a record from Cloudflare",function(done){ + testCflareAccount.getRecord("bleu.de","A") .then(function(responseArg){ console.log(responseArg); done(); }); - });*/ + }); + }); + describe(".removeRecord",function(){ + it("should remove a record from Cloudflare",function(done){ + testCflareAccount.removeRecord("bleu.de","A") + .then(function(responseArg){ + console.log(responseArg); + done(); + }); + }); + it("should remove a subdomain record from Cloudflare",function(done){ + testCflareAccount.removeRecord("subdomain.bleu.de","A") + .then(function(responseArg){ + console.log(responseArg); + done(); + }); + }); }); }) }); diff --git a/ts/cflare.classes.cflareaccount.ts b/ts/cflare.classes.cflareaccount.ts index e17f47c..2647b5f 100644 --- a/ts/cflare.classes.cflareaccount.ts +++ b/ts/cflare.classes.cflareaccount.ts @@ -39,6 +39,7 @@ export class CflareAccount { let filteredResponse = responseArg.result.filter((recordArg) => { return (recordArg.type == typeArg && recordArg.name == domainNameArg); }) + done.resolve(filteredResponse[0]); }) return done.promise; }; @@ -62,9 +63,17 @@ export class CflareAccount { removeRecord(domainNameArg:string,typeArg:string){ let done = plugins.q.defer(); let domain = new plugins.smartstring.Domain(domainNameArg); - this.getRecord(domain.zoneName,typeArg) + this.getRecord(domain.fullName,typeArg) .then((responseArg) => { - + if(responseArg){ + let requestRoute:string = "/zones/" + responseArg.zone_id + "/dns_records/" + responseArg.id; + this.request("DELETE",requestRoute) + .then((responseArg) => { + done.resolve(responseArg); + }); + } else { + done.reject(); + } }); return done.promise; }; @@ -110,6 +119,7 @@ export class CflareAccount { }, body:jsonArg }; + //console.log(options); plugins.request(options,function(err, res, body){ if (!err && res.statusCode == 200) { var responseObj = JSON.parse(body);