1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

update dependencies and switch to js-yaml 4.0

This commit is contained in:
Massimo Candela
2021-01-08 19:17:22 +01:00
parent 1e07b174fb
commit d2e39e63d0
6 changed files with 28 additions and 19 deletions

View File

@@ -167,7 +167,7 @@ switch(params._[0]) {
append: !!params.A,
logger: null,
getCurrentPrefixesList: () => {
return Promise.resolve(yaml.safeLoad(fs.readFileSync(params.o, "utf8")));
return Promise.resolve(yaml.load(fs.readFileSync(params.o, "utf8")));
}
};

23
package-lock.json generated
View File

@@ -1735,6 +1735,7 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
},
@@ -1742,7 +1743,8 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
}
}
},
@@ -2690,7 +2692,8 @@
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"estraverse": {
"version": "4.3.0",
@@ -3747,12 +3750,18 @@
"dev": true
},
"js-yaml": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz",
"integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==",
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
"argparse": "^2.0.1"
},
"dependencies": {
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
}
}
},
"jsbn": {

View File

@@ -65,7 +65,7 @@
"inquirer": "^7.3.3",
"ip-address": "^6.4.0",
"ip-sub": "^1.0.17",
"js-yaml": "^3.14.1",
"js-yaml": "^4.0.0",
"kafkajs": "^1.15.0",
"md5": "^2.3.0",
"moment": "^2.29.1",

View File

@@ -155,7 +155,7 @@ const ymlBasicConfig = yaml.dump(config);
if (fs.existsSync(vector.configFile)) {
try {
config = yaml.safeLoad(fs.readFileSync(vector.configFile, 'utf8')) || config;
config = yaml.load(fs.readFileSync(vector.configFile, 'utf8')) || config;
} catch (error) {
throw new Error("The file " + vector.configFile + " is not valid yml: " + error.message.split(":")[0]);
}
@@ -169,7 +169,7 @@ if (fs.existsSync(vector.configFile)) {
})
.then((response) => {
fs.writeFileSync(vector.configFile, response.data);
yaml.safeLoad(fs.readFileSync(vector.configFile, 'utf8')); // Test readability and format
yaml.load(fs.readFileSync(vector.configFile, 'utf8')); // Test readability and format
})
.catch(() => {
fs.writeFileSync(vector.configFile, ymlBasicConfig); // Download failed, write simple default config

View File

@@ -102,7 +102,7 @@ export default class InputYml extends Input {
if (fs.existsSync(file)) {
fileContent = fs.readFileSync(file, 'utf8');
try {
monitoredPrefixesFile = yaml.safeLoad(fileContent) || {};
monitoredPrefixesFile = yaml.load(fileContent) || {};
this._watchPrefixFile(file);
} catch (error) {
reject(new Error("The file " + prefixesFile + " is not valid yml: " + error.message.split(":")[0]));

View File

@@ -70,8 +70,8 @@ describe("Prefix List", function() {
const result = fs.readFileSync(outputFile, 'utf8');
fs.unlinkSync(outputFile);
const original = fs.readFileSync(originalFile, 'utf8');
const resultJson = yaml.safeLoad(result) || {};
const originalJson = yaml.safeLoad(original) || {};
const resultJson = yaml.load(result) || {};
const originalJson = yaml.load(original) || {};
expect(resultJson).to.contain.keys(Object.keys(originalJson));
expect(Object.keys(resultJson).length).to.equal(Object.keys(originalJson).length);
@@ -109,8 +109,8 @@ describe("Prefix List", function() {
const result = fs.readFileSync(outputFile, 'utf8');
fs.unlinkSync(outputFile);
const original = fs.readFileSync(originalFile, 'utf8');
const resultJson = yaml.safeLoad(result) || {};
const originalJson = yaml.safeLoad(original) || {};
const resultJson = yaml.load(result) || {};
const originalJson = yaml.load(original) || {};
expect(resultJson).to.contain.keys(Object.keys(originalJson));
expect(Object.keys(resultJson).length).to.equal(Object.keys(originalJson).length);
@@ -141,7 +141,7 @@ describe("Prefix List", function() {
append: true,
logger: () => {},
getCurrentPrefixesList: () => {
const content = yaml.safeLoad(fs.readFileSync(outputFile, "utf8"));
const content = yaml.load(fs.readFileSync(outputFile, "utf8"));
return Promise.resolve(content);
}
}
@@ -154,8 +154,8 @@ describe("Prefix List", function() {
const result = fs.readFileSync(outputFile, 'utf8');
fs.unlinkSync(outputFile);
const original = fs.readFileSync(originalFile, 'utf8');
const resultJson = yaml.safeLoad(result) || {};
const originalJson = yaml.safeLoad(original) || {};
const resultJson = yaml.load(result) || {};
const originalJson = yaml.load(original) || {};
expect(resultJson).to.contain.keys(Object.keys(originalJson));
expect(Object.keys(resultJson).length).to.equal(Object.keys(originalJson).length);