Socket
Socket
Sign inDemoInstall

virtualbox-soap

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1 to 3.0.2

120

generate-index.js

@@ -45,3 +45,3 @@ /*

let curNode = stack[i];
if (curNode.name === nodeName) {
if (!nodeName || curNode.name === nodeName) {
return curNode;

@@ -62,3 +62,8 @@ }

const attributes = node.attributes;
results[attributes.name] = attributes.value;
const resultInfo = {
value: attributes.value,
desc: []
};
node.object = resultInfo;
results[attributes.name] = resultInfo;
} else {

@@ -90,2 +95,3 @@ node.skip = true;

name: name,
desc: [],
parent: parentInterface,

@@ -101,2 +107,3 @@ methods: []

name: node.attributes.name,
desc: [],
in: [],

@@ -113,4 +120,16 @@ out: [],

const value = node.attributes.value;
enumObject.values[name] = value;
const constObject = {
value: value,
desc: []
};
enumObject.values[name] = constObject;
node.object = constObject;
},
desc: function(node) {
const parentObject = getParentNode().object;
const desc = parentObject ? parentObject.desc : null;
if (desc) {
node.content = desc;
}
},
enum: function(node) {

@@ -120,2 +139,3 @@ const name = node.attributes.name;

name: name,
desc: [],
values: {}

@@ -131,4 +151,6 @@ };

type: attributes.type,
array: attributes.safearray === "yes"
array: attributes.safearray === "yes",
desc: []
};
node.object = paramObject;
if (dir === "in") {

@@ -153,6 +175,7 @@ methodObject.in.push(paramObject);

const baseName = name[0].toUpperCase() + name.slice(1);
interfaceObject.methods.push({
const getterObject = {
name: "get" + baseName,
in: [],
out: [],
desc: [],
returnval: {

@@ -163,3 +186,5 @@ name: name,

}
});
};
node.object = getterObject;
interfaceObject.methods.push(getterObject);
if (attributes.readonly !== "yes") {

@@ -183,3 +208,8 @@ interfaceObject.methods.push({

saxStream.on("opentag", function(node) {
const skip = stack.length > 0 ? stack[stack.length - 1].skip : false;
const lastStackNode = stack.length > 0 ? stack[stack.length - 1] : null;
if (lastStackNode && lastStackNode.content) {
node.content = [];
lastStackNode.content.push(node);
}
const skip = lastStackNode ? lastStackNode.skip : false;
const tagHandler = tagHandlers[node.name];

@@ -194,2 +224,9 @@ if (tagHandler && !skip) {

saxStream.on("text", function(text) {
const lastStackNode = stack.length > 0 ? stack[stack.length - 1] : null;
if (lastStackNode && lastStackNode.content) {
lastStackNode.content.push(text);
}
});
saxStream.on("closetag", function() {

@@ -242,2 +279,31 @@ stack.pop();

const generateComment = function(desc) {
if (!desc) {
return "";
}
return desc
.map(function(node) {
if (typeof node === "string") {
return node;
} else if (node.name === "link") {
let to = node.attributes.to;
to = to.replace(/^#/, "");
return to;
} else if (node.name === "see") {
return `See: ${generateComment(node.content)}`;
} else if (node.name === "note") {
return `Note: ${generateComment(node.content)}`;
} else if (node.name === "result") {
return `Error ${node.attributes.name}: ${generateComment(
node.content
)}`;
} else {
const tag = node.name;
return `<${tag}>${generateComment(node.content)}</${tag}>`;
}
})
.join("")
.replace(/\s*@\w+\s*/g, " ");
};
saxStream.on("end", function() {

@@ -291,6 +357,15 @@ const output = [

objectKeysNonEmpty(enums).forEach(function(keyName) {
output.push(`export const enum ${keyName} {`);
const enumInfo = enums[keyName];
const values = enumInfo.values;
const comment = generateComment(enumInfo.desc);
if (comment) {
output.push("/**", comment, "*/");
}
output.push(`export const enum ${keyName} {`);
objectKeysNonEmpty(values).forEach(function(enumName) {
const constObject = values[enumName];
const comment = generateComment(constObject.desc);
if (comment) {
output.push("/**", comment, "*/");
}
output.push(`${enumName} = ${JSON.stringify(enumName)},`);

@@ -302,2 +377,6 @@ });

const interfaceObject = interfaces[interfaceName];
const comment = generateComment(interfaceObject.desc);
if (comment) {
output.push("/**", comment, "*/");
}
const parentClass = interfaceObject.parent

@@ -325,4 +404,6 @@ ? interfaceObject.parent.name

let returnBody = "null";
let returnComment = "";
if (method.returnval) {
returnBody = wrapReturnValue(method.returnval);
returnComment = generateComment(method.returnval.desc);
} else if (method.out.length > 0) {

@@ -332,4 +413,20 @@ returnBody = `({${method.out.map(

)}})`;
returnComment = `Object with the following properties: \n${method.out
.map(
param =>
`${JSON.stringify(param.name)} ${generateComment(param.desc)}`
)
.join("\n")}`;
}
const comment = generateComment(method.desc);
output.push(
"/**",
comment,
...method.in.map(
param => `@param ${param.name} ${generateComment(param.desc)}`
),
returnComment ? `@return ${returnComment}` : "",
"*/"
);
output.push(
` ${method.name}(${method.in

@@ -349,3 +446,8 @@ .map(param => `$${param.name}: ${getParamType(param)}`)

objectKeysNonEmpty(results).forEach(function(keyName) {
output.push(`export const ${keyName} = ${results[keyName]};`);
const resultInfo = results[keyName];
const comment = generateComment(resultInfo.desc);
if (comment) {
output.push("/**", comment, "*/");
}
output.push(`export const ${keyName} = ${resultInfo.value};`);
});

@@ -352,0 +454,0 @@ fs.writeFileSync(path.join(__dirname, "index.ts"), output.join("\n"));

2

package.json
{
"author": "ariatemplates <contact@ariatemplates.com> (http://github.com/ariatemplates)",
"name": "virtualbox-soap",
"version": "3.0.1",
"version": "3.0.2",
"description": "A wrapper for the SOAP API of Virtual Box.",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc