diff --git a/dist/cflare.classes.cflareaccount.d.ts b/dist/cflare.classes.cflareaccount.d.ts index 86b7993..44943d3 100644 --- a/dist/cflare.classes.cflareaccount.d.ts +++ b/dist/cflare.classes.cflareaccount.d.ts @@ -11,7 +11,7 @@ export declare class CflareAccount { getZoneId(domainName: string): any; getRecord(domainNameArg: string, typeArg: string): any; createRecord(domainNameArg: string, typeArg: string, contentArg: string): any; - removeRecord(): any; + removeRecord(domainNameArg: string, typeArg: string): any; updateRecord(domainNameArg: string, typeArg: string, valueArg: any): any; listRecords(domainNameArg: string): any; listZones(domainName?: string): any; diff --git a/dist/cflare.classes.cflareaccount.js b/dist/cflare.classes.cflareaccount.js index 4fd9bee..2b9fe38 100644 --- a/dist/cflare.classes.cflareaccount.js +++ b/dist/cflare.classes.cflareaccount.js @@ -43,14 +43,16 @@ var CflareAccount = (function () { CflareAccount.prototype.createRecord = function (domainNameArg, typeArg, contentArg) { var _this = this; var done = plugins.q.defer(); - this.getZoneId(domainNameArg) + var domain = new plugins.smartstring.Domain(domainNameArg); + var zoneName = domain.level2 + "." + domain.level1; + this.getZoneId(zoneName) .then(function (domainIdArg) { - var dataJson = { - name: domainNameArg, + var dataObject = { + name: domain.fullName, type: typeArg, content: contentArg }; - _this.request("POST", "/zones/" + domainIdArg + "/dns_records", dataJson) + _this.request("POST", "/zones/" + domainIdArg + "/dns_records", dataObject) .then(function (responseArg) { done.resolve(responseArg); }); @@ -58,8 +60,14 @@ var CflareAccount = (function () { return done.promise; }; ; - CflareAccount.prototype.removeRecord = function () { + CflareAccount.prototype.removeRecord = function (domainNameArg, typeArg) { var done = plugins.q.defer(); + var domain = new plugins.smartstring.Domain(domainNameArg); + var zoneName = domain.level2 + "." + domain.level1; + this.listRecords(zoneName) + .then(function (responseArg) { + var filteredResponse = responseArg; + }); return done.promise; }; ; @@ -127,4 +135,4 @@ var CflareAccount = (function () { exports.CflareAccount = CflareAccount; ; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJz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CBmaWx0ZXJlZFJlc3BvbnNlID0gcmVzcG9uc2VBcmcucmVzdWx0LmZpbHRlcigoem9uZUFyZyk9PntcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gem9uZUFyZy5uYW1lID09PSBkb21haW5OYW1lO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsdGVyZWRSZXNwb25zZS5sZW5ndGggPj0gMSl7XHJcbiAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKGZpbHRlcmVkUmVzcG9uc2VbMF0uaWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcInRoZSBkb21haW4gXCIgKyBkb21haW5OYW1lLmJsdWUgKyBcIiBkb2VzIG5vdCBhcHBlYXIgdG8gYmUgaW4gdGhpcyBhY2NvdW50IVwiKTtcclxuICAgICAgICAgICAgICAgICAgICBkb25lLnJlamVjdCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4gICAgfVxyXG4gICAgZ2V0UmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIHRoaXMubGlzdFJlY29yZHMoZG9tYWluTmFtZUFyZylcclxuICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBsZXQgZmlsdGVyZWRSZXNwb25zZSA9IHJlc3BvbnNlQXJnLnJlc3VsdC5maWx0ZXIoKHJlY29yZEFyZykgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAocmVjb3JkQXJnLnR5cGUgPT0gdHlwZUFyZyAmJiByZWNvcmRBcmcubmFtZSA9PSBkb21haW5OYW1lQXJnKTsgXHJcbiAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICB9KVxyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgY3JlYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLGNvbnRlbnRBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIHRoaXMuZ2V0Wm9uZUlkKGRvbWFpbk5hbWVBcmcpXHJcbiAgICAgICAgICAgIC50aGVuKChkb21haW5JZEFyZyk9PntcclxuICAgICAgICAgICAgICAgIGxldCBkYXRhSnNvbiA9IHtcclxuICAgICAgICAgICAgICAgICAgICBuYW1lOiBkb21haW5OYW1lQXJnLFxyXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IHR5cGVBcmcsXHJcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogY29udGVudEFyZ1xyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgICAgIHRoaXMucmVxdWVzdChcIlBPU1RcIixcIi96b25lcy9cIiArIGRvbWFpbklkQXJnICsgXCIvZG5zX3JlY29yZHNcIixkYXRhSnNvbilcclxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgcmVtb3ZlUmVjb3JkKCl7XHJcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgICAgICBy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RlICsgXCImbmFtZT1cIiArIGRvbWFpbk5hbWU7XHJcbiAgICAgICAgbGV0IHJlc3VsdCA9IHt9OyBcclxuICAgICAgICB0aGlzLnJlcXVlc3QoXCJHRVRcIixyZXF1ZXN0Um91dGUpXHJcbiAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHJlc3BvbnNlQXJnO1xyXG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3VsdCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgcmVxdWVzdChtZXRob2RBcmc6c3RyaW5nLHJvdXRlQXJnOnN0cmluZyxkYXRhQXJnID0ge30pe1xyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgbGV0IGpzb25Bcmc6c3RyaW5nID0gSlNPTi5zdHJpbmdpZnkoZGF0YUFyZyk7XHJcbiAgICAgICAgbGV0IG9wdGlvbnMgPSB7XHJcbiAgICAgICAgICAgIG1ldGhvZDptZXRob2RBcmcsXHJcbiAgICAgICAgICAgIHVybDpcImh0dHBzOi8vYXBpLmNsb3VkZmxhcmUuY29tL2NsaWVudC92NFwiICsgcm91dGVBcmcsXHJcbiAgICAgICAgICAgIGhlYWRlcnM6e1xyXG4gICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjpcImFwcGxpY2F0aW9uL2pzb25cIixcclxuICAgICAgICAgICAgICAgIFwiWC1BdXRoLUVtYWlsXCI6dGhpcy5hdXRoRW1haWwsXHJcbiAgICAgICAgICAgICAgICBcIlgtQXV0aC1LZXlcIjp0aGlzLmF1dGhLZXlcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgYm9keTpqc29uQXJnXHJcbiAgICAgICAgfTtcclxuICAgICAgICBwbHVnaW5zLnJlcXVlc3Qob3B0aW9ucyxmdW5jdGlvbihlcnIsIHJlcywgYm9keSl7XHJcbiAgICAgICAgICAgIGlmICghZXJyICYmIHJlcy5zdGF0dXNDb2RlID09IDIwMCkge1xyXG4gICAgICAgICAgICAgICAgdmFyIHJlc3BvbnNlT2JqID0gSlNPTi5wYXJzZShib2R5KTtcclxuICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZU9iaik7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xyXG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzKTtcclxuICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KGVycik7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxuICAgIH1cclxufTsiXX0= +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5jbGFzc2VzLmNmbGFyZWFjY291bnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFPLE9BQU8sV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRzdDO0lBTUk7SUFFQSxDQUFDO0lBTE8saUNBQVMsR0FBakI7UUFDSSxNQUFNLENBQUMsQ0FBQyxJQUFJLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLDRCQUE0QjtJQUN6RSxDQUFDOztJQUlELDRCQUFJLEdBQUosVUFBSyxVQUFvQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxLQUFLLENBQUM7UUFDbEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsR0FBRyxDQUFDO0lBQ2xD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xyXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcclxuICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJlZFJlc3BvbnNlID0gcmVzcG9uc2VBcmcucmVzdWx0LmZpbHRlcigoem9uZUFyZyk9PntcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gem9uZUFyZy5uYW1lID09PSBkb21haW5OYW1lO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgICAgICBpZiAoZmlsdGVyZWRSZXNwb25zZS5sZW5ndGggPj0gMSl7XHJcbiAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKGZpbHRlcmVkUmVzcG9uc2VbMF0uaWQpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcInRoZSBkb21haW4gXCIgKyBkb21haW5OYW1lLmJsdWUgKyBcIiBkb2VzIG5vdCBhcHBlYXIgdG8gYmUgaW4gdGhpcyBhY2NvdW50IVwiKTtcclxuICAgICAgICAgICAgICAgICAgICBkb25lLnJlamVjdCh1bmRlZmluZWQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4gICAgfVxyXG4gICAgZ2V0UmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIHRoaXMubGlzdFJlY29yZHMoZG9tYWluTmFtZUFyZylcclxuICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBsZXQgZmlsdGVyZWRSZXNwb25zZSA9IHJlc3BvbnNlQXJnLnJlc3VsdC5maWx0ZXIoKHJlY29yZEFyZykgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAocmVjb3JkQXJnLnR5cGUgPT0gdHlwZUFyZyAmJiByZWNvcmRBcmcubmFtZSA9PSBkb21haW5OYW1lQXJnKTsgXHJcbiAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICB9KVxyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgY3JlYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLGNvbnRlbnRBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XHJcbiAgICAgICAgbGV0IHpvbmVOYW1lOnN0cmluZyA9IGRvbWFpbi5sZXZlbDIgKyBcIi5cIiArIGRvbWFpbi5sZXZlbDE7XHJcbiAgICAgICAgdGhpcy5nZXRab25lSWQoem9uZU5hbWUpXHJcbiAgICAgICAgICAgIC50aGVuKChkb21haW5JZEFyZyk9PntcclxuICAgICAgICAgICAgICAgIGxldCBkYXRhT2JqZWN0ID0ge1xyXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IGRvbWFpbi5mdWxsTmFtZSxcclxuICAgICAgICAgICAgICAgICAgICB0eXBlOiB0eXBlQXJnLFxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnRBcmdcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICB0aGlzLnJlcXVlc3QoXCJQT1NUXCIsXCIvem9uZXMvXCIgKyBkb21haW5JZEFyZyArIFwiL2Ruc19yZWNvcmRzXCIsZGF0YU9iamVjdClcclxuICAgICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZUFyZyl7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgcmVtb3ZlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIGxldCBkb21haW4gPSBuZXcgcGx1Z2lucy5zbWFydHN0cmluZy5Eb21haW4oZG9tYWluTmFtZUFyZyk7XHJcbiAgICAgICAgbGV0IHpvbmVOYW1lID0gZG9tYWluLmxldmVsMiArIFwiLlwiICsgZG9tYWluLmxldmVsMTtcclxuICAgICAgICB0aGlzLmxpc3RSZWNvcmRzKHpvbmVOYW1lKVxyXG4gICAgICAgICAgICAudGhlbigocmVzcG9uc2VBcmcpID0+IHtcclxuICAgICAgICAgICAgICAgIGxldCBmaWx0ZXJlZFJlc3BvbnNlID0gcmVzcG9uc2VBcmc7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgdXBkYXRlUmVjb3JkKGRvbWFpbk5hbWVBcmc6c3RyaW5nLHR5cGVBcmc6c3RyaW5nLHZhbHVlQXJnKXtcclxuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xyXG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbiAgICB9O1xyXG4gICAgbGlzdFJlY29yZHMoZG9tYWluTmFtZUFyZzpzdHJpbmcpe1xyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgdGhpcy5nZXRab25lSWQoZG9tYWluTmFtZUFyZylcclxuICAgICAgICAgICAgLnRoZW4oKGRvbWFpbklkQXJnKT0+e1xyXG4gICAgICAgICAgICAgICAgdGhpcy5yZXF1ZXN0KFwiR0VUXCIsXCIvem9uZXMvXCIgKyBkb21haW5JZEFyZyArIFwiL2Ruc19yZWNvcmRzP3Blcl9wYWdlPTEwMFwiKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlQXJnKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxuICAgIH1cclxuICAgIGxpc3Rab25lcyhkb21haW5OYW1lPzpzdHJpbmcpeyAvLyBUT0RPOiBoYW5kbGUgcGFnaW5hdGlvblxyXG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XHJcbiAgICAgICAgbGV0IHJlcXVlc3RSb3V0ZSA9IFwiL3pvbmVzP3Blcl9wYWdlPTUwXCJcclxuICAgICAgICBpZihkb21haW5OYW1lKSByZXF1ZXN0Um91dGUgPSByZXF1ZXN0Um91dGUgKyBcIiZuYW1lPVwiICsgZG9tYWluTmFtZTtcclxuICAgICAgICBsZXQgcmVzdWx0ID0ge307IFxyXG4gICAgICAgIHRoaXMucmVxdWVzdChcIkdFVFwiLHJlcXVlc3RSb3V0ZSlcclxuICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xyXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gcmVzcG9uc2VBcmc7XHJcbiAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUocmVzdWx0KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcclxuICAgIH07XHJcbiAgICByZXF1ZXN0KG1ldGhvZEFyZzpzdHJpbmcscm91dGVBcmc6c3RyaW5nLGRhdGFBcmcgPSB7fSl7XHJcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcclxuICAgICAgICBsZXQganNvbkFyZzpzdHJpbmcgPSBKU09OLnN0cmluZ2lmeShkYXRhQXJnKTtcclxuICAgICAgICBsZXQgb3B0aW9ucyA9IHtcclxuICAgICAgICAgICAgbWV0aG9kOm1ldGhvZEFyZyxcclxuICAgICAgICAgICAgdXJsOlwiaHR0cHM6Ly9hcGkuY2xvdWRmbGFyZS5jb20vY2xpZW50L3Y0XCIgKyByb3V0ZUFyZyxcclxuICAgICAgICAgICAgaGVhZGVyczp7XHJcbiAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOlwiYXBwbGljYXRpb24vanNvblwiLFxyXG4gICAgICAgICAgICAgICAgXCJYLUF1dGgtRW1haWxcIjp0aGlzLmF1dGhFbWFpbCxcclxuICAgICAgICAgICAgICAgIFwiWC1BdXRoLUtleVwiOnRoaXMuYXV0aEtleVxyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBib2R5Ompzb25BcmdcclxuICAgICAgICB9O1xyXG4gICAgICAgIHBsdWdpbnMucmVxdWVzdChvcHRpb25zLGZ1bmN0aW9uKGVyciwgcmVzLCBib2R5KXtcclxuICAgICAgICAgICAgaWYgKCFlcnIgJiYgcmVzLnN0YXR1c0NvZGUgPT0gMjAwKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgcmVzcG9uc2VPYmogPSBKU09OLnBhcnNlKGJvZHkpO1xyXG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlT2JqKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXMpO1xyXG4gICAgICAgICAgICAgICAgZG9uZS5yZWplY3QoZXJyKTtcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9KTtcclxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xyXG4gICAgfVxyXG59OyJdfQ== diff --git a/dist/cflare.plugins.d.ts b/dist/cflare.plugins.d.ts index 97dfb0f..e33d5ca 100644 --- a/dist/cflare.plugins.d.ts +++ b/dist/cflare.plugins.d.ts @@ -2,3 +2,4 @@ import "typings-global"; export declare let beautylog: any; export declare let q: any; export declare let request: any; +export import smartstring = require("smartstring"); diff --git a/dist/cflare.plugins.js b/dist/cflare.plugins.js index 96cd72d..da7ed67 100644 --- a/dist/cflare.plugins.js +++ b/dist/cflare.plugins.js @@ -3,5 +3,6 @@ require("typings-global"); exports.beautylog = require("beautylog"); exports.q = require("q"); exports.request = require("request"); +exports.smartstring = require("smartstring"); -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDYixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxTQUFDLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGVBQU8sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUMiLCJmaWxlIjoiY2ZsYXJlLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiO1xyXG5leHBvcnQgbGV0IGJlYXV0eWxvZyA9IHJlcXVpcmUoXCJiZWF1dHlsb2dcIik7XHJcbmV4cG9ydCBsZXQgcSA9IHJlcXVpcmUoXCJxXCIpO1xyXG5leHBvcnQgbGV0IHJlcXVlc3QgPSByZXF1aXJlKFwicmVxdWVzdFwiKTsiXX0= +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDYixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxTQUFDLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGVBQU8sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7QUFDMUIsbUJBQVcsV0FBVyxhQUFhLENBQUMsQ0FBQyIsImZpbGUiOiJjZmxhcmUucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmV4cG9ydCBsZXQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcclxuZXhwb3J0IGxldCBxID0gcmVxdWlyZShcInFcIik7XHJcbmV4cG9ydCBsZXQgcmVxdWVzdCA9IHJlcXVpcmUoXCJyZXF1ZXN0XCIpO1xyXG5leHBvcnQgaW1wb3J0IHNtYXJ0c3RyaW5nID0gcmVxdWlyZShcInNtYXJ0c3RyaW5nXCIpOyJdfQ== diff --git a/package.json b/package.json index bff9083..637e090 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "beautylog": "^5.0.6", "q": "^1.4.1", "request": "^2.72.0", + "smartstring": "^2.0.0", "typings-global": "^1.0.3" }, "devDependencies": { diff --git a/test/test.js b/test/test.js index 79bd228..cf4f54c 100644 --- a/test/test.js +++ b/test/test.js @@ -42,15 +42,31 @@ describe("cflare", function () { }); describe(".createRecord", function () { this.timeout(10000); - it("should create a valid record for a domain", function (done) { + it("should create a valid record for a level 2 domain", function (done) { testCflareAccount.createRecord("bleu.de", "A", "127.0.0.1") .then(function (responseArg) { console.log(responseArg); done(); }); }); + it("should create a valid record for a subdomain", function (done) { + testCflareAccount.createRecord("subdomain.bleu.de", "A", "127.0.0.1") + .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(); + }); + });*/ }); }); }); -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsSUFBTyxNQUFNLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDekMsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLElBQUksS0FBSyxHQUFHLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0FBRTNDLElBQUksaUJBQWlCLEdBQUcsSUFBSSxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUM7QUFDbkQsaUJBQWlCLENBQUMsSUFBSSxDQUFDO0lBQ25CLEtBQUssRUFBRSxLQUFLLENBQUMsT0FBTztJQUNwQixHQUFHLEVBQUUsS0FBSyxDQUFDLEtBQUs7Q0FDbkIsQ0FBQyxDQUFDO0FBRUgsUUFBUSxDQUFDLFFBQVEsRUFBQztJQUNkLFFBQVEsQ0FBQyxnQkFBZ0IsRUFBQztRQUN0QixRQUFRLENBQUMsY0FBYyxFQUFDO1lBQ3BCLEVBQUUsQ0FBQywyQkFBMkIsRUFBQyxVQUFTLElBQUk7Z0JBQ3hDLElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7Z0JBQ3BCLGlCQUFpQixDQUFDLFNBQVMsRUFBRTtxQkFDeEIsSUFBSSxDQUFDLFVBQUMsV0FBVztvQkFDZCxPQUFPLENBQUMsR0FBRyxDQUFDLFdBQVcsQ0FBQyxDQUF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ICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcclxuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50Lmxpc3Rab25lcygpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKT0+e1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBkZXNjcmliZShcIi5nZXRab25lSWQoZG9tYWluTmFtZSlcIixmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICBpdChcInNob3VsZCBnZXQgYW4gQ2xvdWRmbGFyZSBJZCBmb3IgYSBkb21haW4gc3RyaW5nXCIsZnVuY3Rpb24oZG9uZSl7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApXHJcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5nZXRab25lSWQoXCJwdXNoLnJvY2tzXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKT0+e1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgZGVzY3JpYmUoXCIubGlzdFJlY29yZHMoZG9tYWluTmFtZSlcIixmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICBpdChcInNob3VsZCBsaXN0IGFsbCByZWNvcmRzIGZvciBhIHNwZWNpZmljIERvbWFpbiBOYW1lXCIsZnVuY3Rpb24oZG9uZSl7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xyXG4gICAgICAgICAgICAgICAgdGVzdENmbGFyZUFjY291bnQubGlzdFJlY29yZHMoXCJwdXNoLnJvY2tzXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oKHJlc3BvbnNlQXJnKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlQXJnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KVxyXG4gICAgICAgIGRlc2NyaWJlKFwiLmNyZWF0ZVJlY29yZFwiLGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMCk7XHJcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGNyZWF0ZSBhIHZhbGlkIHJlY29yZCBmb3IgYSBkb21haW5cIixmdW5jdGlvbihkb25lKXtcclxuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50LmNyZWF0ZVJlY29yZChcImJsZXUuZGVcIixcIkFcIixcIjEyNy4wLjAuMVwiKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0pO1xyXG4gICAgfSlcclxufSk7XHJcbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyx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AgICAgICAgICBpdChcInNob3VsZCBkaXNwbGF5IGFuIGFjY291bnRcIixmdW5jdGlvbihkb25lKXtcclxuICAgICAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMCk7XHJcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5saXN0Wm9uZXMoKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZyk9PntcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgZGVzY3JpYmUoXCIuZ2V0Wm9uZUlkKGRvbWFpbk5hbWUpXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICAgICAgaXQoXCJzaG91bGQgZ2V0IGFuIENsb3VkZmxhcmUgSWQgZm9yIGEgZG9tYWluIHN0cmluZ1wiLGZ1bmN0aW9uKGRvbmUpe1xyXG4gICAgICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKVxyXG4gICAgICAgICAgICAgICAgdGVzdENmbGFyZUFjY291bnQuZ2V0Wm9uZUlkKFwicHVzaC5yb2Nrc1wiKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZyk9PntcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0pO1xyXG4gICAgICAgIGRlc2NyaWJlKFwiLmxpc3RSZWNvcmRzKGRvbWFpbk5hbWUpXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICAgICAgaXQoXCJzaG91bGQgbGlzdCBhbGwgcmVjb3JkcyBmb3IgYSBzcGVjaWZpYyBEb21haW4gTmFtZVwiLGZ1bmN0aW9uKGRvbmUpe1xyXG4gICAgICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcclxuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50Lmxpc3RSZWNvcmRzKFwicHVzaC5yb2Nrc1wiKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKChyZXNwb25zZUFyZykgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSlcclxuICAgICAgICBkZXNjcmliZShcIi5jcmVhdGVSZWNvcmRcIixmdW5jdGlvbigpe1xyXG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xyXG4gICAgICAgICAgICBpdChcInNob3VsZCBjcmVhdGUgYSB2YWxpZCByZWNvcmQgZm9yIGEgbGV2ZWwgMiBkb21haW5cIixmdW5jdGlvbihkb25lKXtcclxuICAgICAgICAgICAgICAgIHRlc3RDZmxhcmVBY2NvdW50LmNyZWF0ZVJlY29yZChcImJsZXUuZGVcIixcIkFcIixcIjEyNy4wLjAuMVwiKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBpdChcInNob3VsZCBjcmVhdGUgYSB2YWxpZCByZWNvcmQgZm9yIGEgc3ViZG9tYWluXCIsZnVuY3Rpb24oZG9uZSl7XHJcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5jcmVhdGVSZWNvcmQoXCJzdWJkb21haW4uYmxldS5kZVwiLFwiQVwiLFwiMTI3LjAuMC4xXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVzcG9uc2VBcmcpe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXNwb25zZUFyZyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgZGVzY3JpYmUoXCIucmVtb3ZlUmVjb3JkXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICAgICAgLyppdChcInNob3VsZCByZW1vdmUgYSByZWNvcmQgZnJvbSBDbG91ZGZsYXJlXCIsZnVuY3Rpb24oZG9uZSl7XHJcbiAgICAgICAgICAgICAgICB0ZXN0Q2ZsYXJlQWNjb3VudC5yZW1vdmVSZWNvcmQoKVxyXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlQXJnKXtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2VBcmcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkb25lKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH0pOyovXHJcbiAgICAgICAgfSk7XHJcbiAgICB9KVxyXG59KTtcclxuIl19 diff --git a/test/test.ts b/test/test.ts index 0831898..d92fd65 100644 --- a/test/test.ts +++ b/test/test.ts @@ -43,22 +43,29 @@ describe("cflare",function(){ }) describe(".createRecord",function(){ this.timeout(10000); - it("should create a valid record for a domain",function(done){ + it("should create a valid record for a level 2 domain",function(done){ testCflareAccount.createRecord("bleu.de","A","127.0.0.1") .then(function(responseArg){ console.log(responseArg); done(); }); }); + it("should create a valid record for a subdomain",function(done){ + testCflareAccount.createRecord("subdomain.bleu.de","A","127.0.0.1") + .then(function(responseArg){ + console.log(responseArg); + done(); + }); + }); }); describe(".removeRecord",function(){ - it("should remove a record from Cloudflare",function(done){ + /*it("should remove a record from Cloudflare",function(done){ testCflareAccount.removeRecord() .then(function(responseArg){ console.log(responseArg); done(); - }) - }); + }); + });*/ }); }) }); diff --git a/ts/cflare.classes.cflareaccount.ts b/ts/cflare.classes.cflareaccount.ts index 50b55a9..3476fbe 100644 --- a/ts/cflare.classes.cflareaccount.ts +++ b/ts/cflare.classes.cflareaccount.ts @@ -43,10 +43,12 @@ export class CflareAccount { }; createRecord(domainNameArg:string,typeArg:string,contentArg:string){ let done = plugins.q.defer(); - this.getZoneId(domainNameArg) + let domain = new plugins.smartstring.Domain(domainNameArg); + let zoneName:string = domain.level2 + "." + domain.level1; + this.getZoneId(zoneName) .then((domainIdArg)=>{ let dataObject = { - name: domainNameArg, + name: domain.fullName, type: typeArg, content: contentArg }; @@ -59,7 +61,12 @@ 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) + .then((responseArg) => { + let filteredResponse = responseArg; + }); return done.promise; }; updateRecord(domainNameArg:string,typeArg:string,valueArg){ diff --git a/ts/cflare.plugins.ts b/ts/cflare.plugins.ts index 755b1ec..1347ac4 100644 --- a/ts/cflare.plugins.ts +++ b/ts/cflare.plugins.ts @@ -1,4 +1,5 @@ import "typings-global"; export let beautylog = require("beautylog"); export let q = require("q"); -export let request = require("request"); \ No newline at end of file +export let request = require("request"); +export import smartstring = require("smartstring"); \ No newline at end of file