cisco-axl 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +24 -16
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
|
40
40
|
```javascript
|
|
41
41
|
const axlService = require("cisco-axl");
|
|
42
42
|
|
|
43
|
-
let service = new axlService("10.10.20.1", "administrator", "ciscopsdt");
|
|
43
|
+
let service = new axlService("10.10.20.1", "administrator", "ciscopsdt","14.0");
|
|
44
44
|
|
|
45
45
|
var operation = "addRoutePartition";
|
|
46
46
|
var tags = {
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const soap = require("strong-soap").soap;
|
|
2
2
|
const WSDL = soap.WSDL;
|
|
3
|
-
const path = require(
|
|
3
|
+
const path = require("path");
|
|
4
4
|
const wsdlOptions = {
|
|
5
5
|
attributesKey: "attributes",
|
|
6
6
|
valueKey: "value",
|
|
@@ -102,14 +102,26 @@ class axlService {
|
|
|
102
102
|
var options = this._OPTIONS;
|
|
103
103
|
|
|
104
104
|
var clean = opts?.clean ? opts.clean : false;
|
|
105
|
-
var dataContainerIdentifierTails = opts?.dataContainerIdentifierTails
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
var dataContainerIdentifierTails = opts?.dataContainerIdentifierTails
|
|
106
|
+
? opts.dataContainerIdentifierTails
|
|
107
|
+
: "_data";
|
|
108
|
+
var removeAttributes = opts?.removeAttributes
|
|
109
|
+
? opts.removeAttributes
|
|
110
|
+
: false;
|
|
111
|
+
|
|
108
112
|
// Let's remove empty top level strings. Also filter out json-variables
|
|
109
|
-
Object.keys(tags).forEach(
|
|
113
|
+
Object.keys(tags).forEach(
|
|
114
|
+
(k) =>
|
|
115
|
+
(tags[k] == "" || k.includes(dataContainerIdentifierTails)) &&
|
|
116
|
+
delete tags[k]
|
|
117
|
+
);
|
|
110
118
|
|
|
111
119
|
return new Promise((resolve, reject) => {
|
|
112
120
|
soap.createClient(options.url, wsdlOptions, function (err, client) {
|
|
121
|
+
var customRequestHeader = { connection: "keep-alive" };
|
|
122
|
+
if (err) {
|
|
123
|
+
reject(err);
|
|
124
|
+
}
|
|
113
125
|
client.setSecurity(
|
|
114
126
|
new soap.BasicAuthSecurity(options.username, options.password)
|
|
115
127
|
);
|
|
@@ -123,10 +135,7 @@ class axlService {
|
|
|
123
135
|
|
|
124
136
|
axlFunc(
|
|
125
137
|
tags,
|
|
126
|
-
function (
|
|
127
|
-
err,
|
|
128
|
-
result,
|
|
129
|
-
) {
|
|
138
|
+
function (err, result) {
|
|
130
139
|
if (err) {
|
|
131
140
|
reject(err);
|
|
132
141
|
}
|
|
@@ -135,15 +144,16 @@ class axlService {
|
|
|
135
144
|
if (clean) {
|
|
136
145
|
cleanObj(output);
|
|
137
146
|
}
|
|
138
|
-
if(removeAttributes){
|
|
147
|
+
if (removeAttributes) {
|
|
139
148
|
cleanAttributes(output);
|
|
140
149
|
}
|
|
141
150
|
resolve(output);
|
|
142
|
-
|
|
143
151
|
} else {
|
|
144
|
-
reject(
|
|
152
|
+
reject("No return results");
|
|
145
153
|
}
|
|
146
|
-
}
|
|
154
|
+
},
|
|
155
|
+
null,
|
|
156
|
+
customRequestHeader
|
|
147
157
|
);
|
|
148
158
|
});
|
|
149
159
|
});
|
|
@@ -195,9 +205,7 @@ const cleanAttributes = (object) => {
|
|
|
195
205
|
if (v && typeof v === "object") {
|
|
196
206
|
cleanAttributes(v);
|
|
197
207
|
}
|
|
198
|
-
if (
|
|
199
|
-
(v && typeof v === "object" && 'attributes' in object)
|
|
200
|
-
) {
|
|
208
|
+
if (v && typeof v === "object" && "attributes" in object) {
|
|
201
209
|
if (Array.isArray(object)) {
|
|
202
210
|
object.splice(k, 1);
|
|
203
211
|
} else {
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cisco-axl",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "A library to make Cisco AXL a lot easier",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 NODE_TLS_REJECT_UNAUTHORIZED=0 node ./test/tests.js"
|
|
8
8
|
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/sieteunoseis/cisco-axl.git"
|
|
12
|
+
},
|
|
9
13
|
"keywords": [
|
|
10
14
|
"cisco",
|
|
11
15
|
"node",
|
|
@@ -16,9 +20,13 @@
|
|
|
16
20
|
],
|
|
17
21
|
"author": "Jeremy Worden",
|
|
18
22
|
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/sieteunoseis/cisco-axl/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/sieteunoseis/cisco-axl#readme",
|
|
19
27
|
"dependencies": {
|
|
20
28
|
"soap": "^0.45.0",
|
|
21
|
-
"strong-soap": "^3.4.
|
|
29
|
+
"strong-soap": "^3.4.3"
|
|
22
30
|
},
|
|
23
31
|
"devDependencies": {
|
|
24
32
|
"json-variables": "^10.1.0",
|