diff --git a/experimental.js b/experimental.js index 38bfc8e..4882b69 100644 --- a/experimental.js +++ b/experimental.js @@ -11,7 +11,7 @@ const request = require("request"); const rest = require("./rest.js"); - +const crypto = require ('crypto'); var domainName, username,password,timeout; @@ -36,6 +36,12 @@ var loginStageCounter = 0; const maxRunningWorkflows = 20; +function generateUUID(){ + var hexstring = crypto.randomBytes(16).toString("hex"); + var guidstring = "UI-" + hexstring.substring(0,8) + "-" + hexstring.substring(8,12) + "-" + hexstring.substring(12,16) + "-" + hexstring.substring(16,20) + "-" + hexstring.substring(20); + return guidstring; +} + function debug(message){ dbg.message(" " + message,4); } @@ -206,7 +212,9 @@ function setHeaders() var headers = [ {name:"authtoken",value:authtoken}, {name:"accept",value:"application/json"}, - {name:"x-csrf-token",value:csrf}, + //{name:"x-csrf-token",value:csrf}, + {name:"X-Requested-With",value:"XMLHttpRequest"}, + {name:"X-Request-ID",value:generateUUID()}, ]; return headers; } @@ -362,7 +370,8 @@ function processListResponse(url,err,body,res){ else { dbg.message("Failed to get Running Workflows",1) - dbg.message(err,1); + if(body!=null)dbg.message(JSON.stringify(body),1); + if(err!=null)dbg.message(JSON.stringify(err),2); process.exit(99); } } @@ -393,8 +402,8 @@ function processRunningResponse(url,err,body,res){ else { dbg.message("Failed to get Running Workflows",1) - dbg.message(err,4) - dbg.message(body,4) + if(body!=null)dbg.message(JSON.stringify(body),1); + if(err!=null)dbg.message(JSON.stringify(err),2); process.exit(99); } } diff --git a/package-lock.json b/package-lock.json index 9da6dcc..2d4406b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { - "fast-deep-equal": "3.1.3", - "fast-json-stable-stringify": "2.1.0", - "json-schema-traverse": "0.4.1", - "uri-js": "4.4.1" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, "asn1": { @@ -22,7 +22,7 @@ "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "~2.1.0" } }, "assert-plus": { @@ -55,7 +55,7 @@ "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "caseless": { @@ -70,7 +70,7 @@ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "commander": { @@ -91,7 +91,7 @@ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "delayed-stream": { @@ -106,8 +106,8 @@ "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, "requires": { - "jsbn": "0.1.1", - "safer-buffer": "2.1.2" + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" } }, "extend": { @@ -146,9 +146,9 @@ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.8", - "mime-types": "2.1.34" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" } }, "getpass": { @@ -157,7 +157,7 @@ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" } }, "har-schema": { @@ -172,8 +172,8 @@ "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", "dev": true, "requires": { - "ajv": "6.12.6", - "har-schema": "2.0.0" + "ajv": "^6.12.3", + "har-schema": "^2.0.0" } }, "http-signature": { @@ -182,9 +182,9 @@ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.2", - "sshpk": "1.17.0" + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "is-typedarray": { @@ -291,26 +291,26 @@ "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.11.0", - "caseless": "0.12.0", - "combined-stream": "1.0.8", - "extend": "3.0.2", - "forever-agent": "0.6.1", - "form-data": "2.3.3", - "har-validator": "5.1.5", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.34", - "oauth-sign": "0.9.0", - "performance-now": "2.1.0", - "qs": "6.5.3", - "safe-buffer": "5.2.1", - "tough-cookie": "2.5.0", - "tunnel-agent": "0.6.0", - "uuid": "3.4.0" + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" } }, "safe-buffer": { @@ -331,15 +331,15 @@ "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, "requires": { - "asn1": "0.2.6", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.2", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.2", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "safer-buffer": "2.1.2", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" } }, "tough-cookie": { @@ -348,8 +348,8 @@ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, "requires": { - "psl": "1.8.0", - "punycode": "2.1.1" + "psl": "^1.1.28", + "punycode": "^2.1.1" } }, "tunnel-agent": { @@ -358,7 +358,7 @@ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "requires": { - "safe-buffer": "5.2.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -373,7 +373,7 @@ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "requires": { - "punycode": "2.1.1" + "punycode": "^2.1.0" } }, "uuid": { @@ -388,9 +388,9 @@ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "assert-plus": "1.0.0", + "assert-plus": "^1.0.0", "core-util-is": "1.0.2", - "extsprintf": "1.3.0" + "extsprintf": "^1.2.0" } } } diff --git a/wmiocli.js b/wmiocli.js index 4f1d57c..e332278 100644 --- a/wmiocli.js +++ b/wmiocli.js @@ -4,7 +4,7 @@ * Apache-2.0 */ -const versionNo = "2022.10.1" +const versionNo = "2022.11.1" const { Command, Option } = require('commander'); const { exit } = require('process'); const readline = require('readline-sync'); @@ -18,6 +18,7 @@ var flowservice = require('./flowservice.js'); var experimental = require('./experimental.js'); const { setLogLevel } = require('./debug.js'); + dbg = require('./debug.js'); prettyprint = false; proxy = undefined; @@ -658,7 +659,7 @@ program.command('flowservice-execute [input-json]') experimental.projectDeployments(projectId); }); - program.command('experimental-workflow-monitor [execution-status] [start-date] [end-date] [project-id] [workflow-id] ',{hidden: true}) + program.command('experimental-workflow-monitor [execution-status] [start-date] [end-date] [project-id] [workflow-id]',{hidden: true}) .description('List Workflow Monitor') .action((executionStatus,startDate,endDate,projectId,workflowId) => { checkOptions();