@firstdorsal/powerdns-api
Advanced tools
Comparing version 1.9.1 to 1.10.0
48
index.js
"use strict"; | ||
const f = require("node-fetch"); | ||
const secondLevelRegex = new RegExp(/[A-Z-a-z0-9]{1,63}\.[A-Z-a-z0-9]{1,63}$/); | ||
/** | ||
@@ -145,4 +144,2 @@ * @typedef Cryptokey | ||
const dname = this.absoluteName(zoneName); | ||
const zoneNameSan = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
return f(`${this.baseurl}/zones`, { | ||
@@ -155,3 +152,3 @@ method: "POST", | ||
body: JSON.stringify({ | ||
name: zoneNameSan + ".", | ||
name: this.absoluteName(zoneName), | ||
kind | ||
@@ -184,5 +181,4 @@ }) | ||
if (typeof zoneName !== "string") throw new TypeError("zoneName must be of type string"); | ||
const dname = this.absoluteName(zoneName); | ||
const zoneNameSan = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
return f(this.baseurl + "/zones/" + zoneNameSan, { | ||
return f(this.baseurl + "/zones/" + this.absoluteName(zoneName), { | ||
method: "GET", | ||
@@ -228,5 +224,4 @@ headers: { | ||
if (typeof zoneName !== "string") throw new TypeError("zoneName must be of type string"); | ||
const dname = this.absoluteName(zoneName); | ||
const zoneNameSan = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
return f(this.baseurl + "/zones/" + zoneNameSan, { | ||
return f(this.baseurl + "/zones/" + this.absoluteName(zoneName), { | ||
method: "DELETE", | ||
@@ -264,4 +259,2 @@ headers: { | ||
const dname = this.absoluteName(records[0].name); | ||
const zoneName = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
let rrsets = []; | ||
@@ -287,3 +280,3 @@ for (let i = 0; i < records.length; i++) { | ||
} | ||
return f(this.baseurl + "/zones/" + zoneName, { | ||
return f(this.baseurl + "/zones/" + this.absoluteName(records[0].name), { | ||
method: "PATCH", | ||
@@ -328,4 +321,2 @@ headers: { | ||
if (!Array.isArray(records)) throw new TypeError("records must be of type array"); | ||
const dname = this.absoluteName(records[0].name); | ||
const zoneName = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
@@ -341,3 +332,3 @@ let rrsets = []; | ||
return f(this.baseurl + "/zones/" + zoneName, { | ||
return f(this.baseurl + "/zones/" + this.absoluteName(records[0].name), { | ||
method: "PATCH", | ||
@@ -445,5 +436,3 @@ headers: { | ||
const dname = this.absoluteName(zoneName); | ||
const zoneNameSan = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
return f(`${this.baseurl}/zones/${zoneNameSan}/cryptokeys`, { | ||
return f(`${this.baseurl}/zones/${this.absoluteName(zoneName)}/cryptokeys`, { | ||
method: "POST", | ||
@@ -478,6 +467,3 @@ headers: { | ||
if (!zoneName) throw new Error("Missing zone/domain name"); | ||
const dname = this.absoluteName(zoneName); | ||
const zoneNameSan = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
return f(`${this.baseurl}/zones/${zoneNameSan}/cryptokeys`, { | ||
return f(`${this.baseurl}/zones/${this.absoluteName(zoneName)}/cryptokeys`, { | ||
method: "GET", | ||
@@ -510,6 +496,3 @@ headers: { | ||
if (!zoneName) throw new Error("Missing zone/domain name"); | ||
const dname = this.absoluteName(zoneName); | ||
const zoneNameSan = dname.substr(0, dname.length - 1).match(secondLevelRegex)[0]; | ||
return f(`${this.baseurl}/zones/${zoneNameSan}/cryptokeys/${cryptokeyId}`, { | ||
return f(`${this.baseurl}/zones/${this.absoluteName(zoneName)}/cryptokeys/${cryptokeyId}`, { | ||
method: "DELETE", | ||
@@ -724,9 +707,14 @@ headers: { | ||
{ | ||
name: zone.domain.match(secondLevelRegex)[0], | ||
name: this.absoluteName(zone.domain), | ||
type: "SOA", | ||
ttl: 3600, | ||
content: [`${this.absoluteName(zone.nameserver[0])} ${zone.hostmasterEmail.replace("@", ".")}. 2020111501 10800 3600 604800 3600`] | ||
content: [ | ||
`${this.absoluteName(zone.nameserver[0])} ${zone.hostmasterEmail.replace( | ||
"@", | ||
"." | ||
)}. 2020111501 10800 3600 604800 3600` | ||
] | ||
}, | ||
{ | ||
name: zone.domain.match(secondLevelRegex)[0], | ||
name: this.absoluteName(zone.domain), | ||
type: "NS", | ||
@@ -733,0 +721,0 @@ ttl: 3600, |
{ | ||
"name": "@firstdorsal/powerdns-api", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "A Nodejs client for the PowerDns API with the most relevant functions.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
65043
1038