Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firstdorsal/powerdns-api

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firstdorsal/powerdns-api - npm Package Compare versions

Comparing version 1.4.2 to 1.5.0

112

index.js
'use strict';
const f = require("node-fetch")
const r = require("request-promise");
/**

@@ -149,17 +146,23 @@ * @typedef Cryptokey

const zoneNameSan = dname.substr(0, dname.length - 1).match(/[A-Za-z0-9]*\.[A-Za-z0-9]*$/)[0];
return r(`${this.baseurl}/zones`, {
method: 'post',
return f(`${this.baseurl}/zones`, {
method: 'POST',
headers: {
'X-Api-Key': this.apikey
'X-Api-Key': this.apikey,
"Content-Type": "application/json"
},
body: {
body: JSON.stringify({
name: zoneNameSan + '.',
kind
},
json: true
}).then((res) => {
if (!res.rrsets) return false;
return res.rrsets[0]
})
}).then(async (res) => {
let j = await res.text().catch();
try {
j = JSON.parse(j);
} catch (err) {
throw j;
}
if (!j.rrsets) return false;
return j.rrsets[0]
}).catch((err) => {
throw new Error(err.error.error);
throw new Error(err);
});

@@ -222,3 +225,3 @@ }

const zoneNameSan = dname.substr(0, dname.length - 1).match(/[A-Za-z0-9]*\.[A-Za-z0-9]*$/)[0];
return r(this.baseurl + '/zones/' + zoneNameSan, {
return f(this.baseurl + '/zones/' + zoneNameSan, {
method: 'DELETE',

@@ -229,6 +232,15 @@ headers: {

json: true
}).then((res) => {
if (res === undefined) return true;
}).then(async (res) => {
let j = await res.text().catch();
if (j) {
try {
j = JSON.parse(j);
} catch (err) {
throw j;
}
}
if (j === undefined || j.length === 0) return true;
return false;
}).catch((err) => {
throw new Error(err.error.error);
throw err;
})

@@ -274,3 +286,3 @@ }

}
return r(this.baseurl + '/zones/' + zoneName, {
return f(this.baseurl + '/zones/' + zoneName, {
method: 'PATCH',

@@ -280,13 +292,19 @@ headers: {

},
body: {
body: JSON.stringify({
rrsets
},
json: true
}).then((res) => {
if (res === undefined) return true;
})
}).then(async (res) => {
let j = await res.text().catch();
if (j) {
try {
j = JSON.parse(j);
} catch (err) {
throw j;
}
}
if (j === undefined || j.length === 0) return true;
return false;
}).catch((err) => {
console.error(err);
return false;
throw err;
});

@@ -319,3 +337,3 @@ }

return r(this.baseurl + '/zones/' + zoneName, {
return f(this.baseurl + '/zones/' + zoneName, {
method: 'PATCH',

@@ -325,12 +343,18 @@ headers: {

},
body: {
body: JSON.stringify({
rrsets
},
json: true
}).then((res) => {
if (res === undefined) return true;
})
}).then(async (res) => {
let j = await res.text().catch();
if (j) {
try {
j = JSON.parse(j);
} catch (err) {
throw j;
}
}
if (j === undefined || j.length === 0) return true;
return false;
}).catch((err) => {
console.error(err);
return false;
throw err;
});

@@ -411,6 +435,5 @@ }

const body = cryptokey;
const dname = this.absoluteName(zoneName);
const zoneNameSan = dname.substr(0, dname.length - 1).match(/[A-Za-z0-9]*\.[A-Za-z0-9]*$/)[0];
return r(`${this.baseurl}/zones/${zoneNameSan}/cryptokeys`, {
return f(`${this.baseurl}/zones/${zoneNameSan}/cryptokeys`, {
method: 'POST',

@@ -420,8 +443,15 @@ headers: {

},
body,
json: true
}).then((res) => {
if (returnPrivateKey) return res;
delete res.privatekey;
return res;
body: JSON.stringify(cryptokey)
}).then(async (res) => {
let j = await res.text().catch();
if (j) {
try {
j = JSON.parse(j);
} catch (err) {
throw j;
}
}
if (returnPrivateKey) return j;
delete j.privatekey;
return j;
})

@@ -428,0 +458,0 @@ }

{
"name": "@firstdorsal/powerdns-api",
"version": "1.4.2",
"version": "1.5.0",
"description": "Nodejs PowerDNS API.",

@@ -9,5 +9,3 @@ "main": "index.js",

"dependencies": {
"node-fetch": "^2.6.0",
"request": "^2.88.2",
"request-promise": "^4.2.6"
"node-fetch": "^2.6.0"
},

@@ -14,0 +12,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc