From 1bb4b4f99fc70a52fd07edd0e7be104d167b546d Mon Sep 17 00:00:00 2001 From: sagpembo Date: Tue, 14 Nov 2023 11:36:19 +0000 Subject: [PATCH 1/2] added ref data add/update --- package-lock.json | 285 ++++++++++++++++++++++++++++++++-------------- projects.js | 76 +++++++++++-- rest.js | 51 ++++++++- wmiocli.js | 49 ++++++++ 4 files changed, 364 insertions(+), 97 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2d4406b..b5ff776 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,296 +1,375 @@ { "name": "wmiocli", "version": "2021.1.0", - "lockfileVersion": 1, + "lockfileVersion": 3, "requires": true, - "dependencies": { - "ajv": { + "packages": { + "": { + "name": "wmiocli", + "version": "2021.1.0", + "license": "Apache-2.0", + "dependencies": { + "readline-sync": "^1.4.10" + }, + "bin": { + "wmiocli": "wmiocli.js" + }, + "devDependencies": { + "commander": "^8.3.0", + "request": "^2.88.2" + } + }, + "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "requires": { + "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "asn1": { + "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, - "requires": { + "dependencies": { "safer-buffer": "~2.1.0" } }, - "assert-plus": { + "node_modules/assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true + "dev": true, + "engines": { + "node": ">=0.8" + } }, - "asynckit": { + "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, - "aws-sign2": { + "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true + "dev": true, + "engines": { + "node": "*" + } }, - "aws4": { + "node_modules/aws4": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, - "bcrypt-pbkdf": { + "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, - "requires": { + "dependencies": { "tweetnacl": "^0.14.3" } }, - "caseless": { + "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, - "combined-stream": { + "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "requires": { + "dependencies": { "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "commander": { + "node_modules/commander": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", - "dev": true + "dev": true, + "engines": { + "node": ">= 12" + } }, - "core-util-is": { + "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "dashdash": { + "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, - "requires": { + "dependencies": { "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" } }, - "delayed-stream": { + "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "dev": true, + "engines": { + "node": ">=0.4.0" + } }, - "ecc-jsbn": { + "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, - "requires": { + "dependencies": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" } }, - "extend": { + "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, - "extsprintf": { + "node_modules/extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true + "dev": true, + "engines": [ + "node >=0.6.0" + ] }, - "fast-deep-equal": { + "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, - "fast-json-stable-stringify": { + "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, - "forever-agent": { + "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true + "dev": true, + "engines": { + "node": "*" + } }, - "form-data": { + "node_modules/form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", "dev": true, - "requires": { + "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" } }, - "getpass": { + "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, - "requires": { + "dependencies": { "assert-plus": "^1.0.0" } }, - "har-schema": { + "node_modules/har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "har-validator": { + "node_modules/har-validator": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", "dev": true, - "requires": { + "dependencies": { "ajv": "^6.12.3", "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" } }, - "http-signature": { + "node_modules/http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dev": true, - "requires": { + "dependencies": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" } }, - "is-typedarray": { + "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, - "isstream": { + "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "jsbn": { + "node_modules/jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true }, - "json-schema": { + "node_modules/json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, - "json-schema-traverse": { + "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stringify-safe": { + "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "jsprim": { + "node_modules/jsprim": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dev": true, - "requires": { + "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.4.0", "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" } }, - "mime-db": { + "node_modules/mime-db": { "version": "1.51.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.6" + } }, - "mime-types": { + "node_modules/mime-types": { "version": "2.1.34", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", "dev": true, - "requires": { + "dependencies": { "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" } }, - "oauth-sign": { + "node_modules/oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true + "dev": true, + "engines": { + "node": "*" + } }, - "performance-now": { + "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, - "psl": { + "node_modules/psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true }, - "punycode": { + "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "qs": { + "node_modules/qs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.6" + } }, - "readline-sync": { + "node_modules/readline-sync": { "version": "1.4.10", "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", - "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==", + "engines": { + "node": ">= 0.8.0" + } }, - "request": { + "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", "dev": true, - "requires": { + "dependencies": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", "caseless": "~0.12.0", @@ -311,26 +390,43 @@ "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" } }, - "safe-buffer": { + "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "safer-buffer": { + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "sshpk": { + "node_modules/sshpk": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, - "requires": { + "dependencies": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", "bcrypt-pbkdf": "^1.0.0", @@ -340,54 +436,75 @@ "jsbn": "~0.1.0", "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" } }, - "tough-cookie": { + "node_modules/tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, - "requires": { + "dependencies": { "psl": "^1.1.28", "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" } }, - "tunnel-agent": { + "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, - "requires": { + "dependencies": { "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" } }, - "tweetnacl": { + "node_modules/tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, - "uri-js": { + "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, - "requires": { + "dependencies": { "punycode": "^2.1.0" } }, - "uuid": { + "node_modules/uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } }, - "verror": { + "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, - "requires": { + "engines": [ + "node >=0.6.0" + ], + "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", "extsprintf": "^1.2.0" diff --git a/projects.js b/projects.js index 31c1145..ba7ef77 100644 --- a/projects.js +++ b/projects.js @@ -167,17 +167,39 @@ $ node wmiocli.js e.g. project-ref-data project-uid -\x1b[32mList Reference Data List:\x1b[0m +\x1b[32mList Reference Data Get Item:\x1b[0m $ node wmiocli.js -d tenant.int-aws-us.webmethods.io -u user -p password - referencedata project_name ref-data-name + project-ref-data project-uid ref-data-name e.g. + project-ref-data project-uid ref-data-name project-ref-data project-uid ref-data-name json project-ref-data project-uid ref-data-name csv + +\x1b[32mAdd Reference Data:\x1b[0m +$ node wmiocli.js + -d tenant.int-aws-us.webmethods.io + -u user + -p password + project-ref-data-add project-uid name description filepath + + e.g. + project-ref-data-add flf1111 reflookup description test.csv + +\x1b[32mUpdate Reference Data:\x1b[0m +$ node wmiocli.js + -d tenant.int-aws-us.webmethods.io + -u user + -p password + project-ref-data-add project-uid name description filepath + + e.g. + project-ref-data-update flf1111 reflookup description test.csv `; + } function init(inDomainName, inUsername, inPassword, inTimeout, inPrettyprint) { domainName = inDomainName; @@ -219,20 +241,42 @@ function listRefData(projectId){ function getRefData(projectId,refDataName,format){ debug("Getting Reference Data - Project [" + projectId + "] name [" + refDataName + "] format [" + format + "]"); - url += "/" + projectId + "/referencedata + "/ + refDataName; + url += "/" + projectId + "/referencedata/" + refDataName; + debug("URL is: " + url); if(format && format.toLowerCase()=="csv")request.getPlain(url, username, password, timeout, processResponse); else request.get(url, username, password, timeout, processResponse); } -function addRefData(projectId,name,description,filename,encoding,separator,qualifier){ +function addRefData(projectId,name,description,filename,separator,qualifier,encoding){ + debug("Adding Reference Data to project [" + projectId + "]"); + debug(`Fields: ${projectId},${name},${description},${filename},${separator},${qualifier},${encoding}`); + url += "/" + projectId + "/referencedata"; + + var data={}; + data.name = name; + data.description = description; + data.file = filename; + data.file_encoding = encoding; + data.field_separator = separator; + data.text_qualifier = qualifier; + + request.uploadFileFormData(url,username,password,timeout,data,filename,processResponse,"POST"); +} + +function updateRefData(projectId,name,description,filename,separator,qualifier,encoding){ debug("Adding Reference Data to project [" + projectId + "]"); - var body={}; - body.name = name; - body.description = description; - //file - body.file_encoding = encoding; - body.field_separator = separator; - body.text_qualifier=qualifier; + debug(`Fields: ${projectId},${name},${description},${filename},${separator},${qualifier},${encoding}`); + url += "/" + projectId + "/referencedata/" + name; + + var data={}; + data.name = name; + data.description = description; + data.file = filename; + data.file_encoding = encoding; + data.field_separator = separator; + data.text_qualifier = qualifier; + + request.uploadFileFormData(url,username,password,timeout,data,filename,processResponse,"PUT"); } @@ -331,6 +375,13 @@ function setWebhookAuth(projectId, workflowUid, authType) { request.post(url, username, password, timeout, data, processResponse); } +function exportProj(projectId){ + debug("Exporting Project [" + projectId + "]"); + url += "/" + projectId + "/export"; + data = undefined; + request.post(url, username, password, timeout, data, processResponse); +} + /* Deployment */ @@ -396,5 +447,6 @@ module.exports = { createParam, updateParam, listParam, deleteParam, listWebhooks, regenWebhook, setWebhookAuth, listTriggers, deleteTrigger, - listRefData, getRefData + listRefData, getRefData, addRefData, updateRefData, + exportProj }; diff --git a/rest.js b/rest.js index 0e31ee9..55b85c9 100644 --- a/rest.js +++ b/rest.js @@ -167,6 +167,55 @@ function sendBody(restEndPoint,user,pass,timeout,data,type,callback){ } +function uploadFileFormData(restEndPoint,user,pass,timeout,data,filename,callback,method){ + debug("postUploadFile Filename ["+ filename + "] to: " + restEndPoint); + var options = { + url: restEndPoint, + json: true, + method: method, + timeout: timeout*1000, + headers: { + 'Content-Type': 'multipart/form-data', + 'Accept': 'application/json' + }, + formData : { + 'file' : fs.createReadStream(filename), + 'name' : data.name, + 'description' : data.description, + 'file_encoding' : data.file_encoding, + 'field_separator' : data.field_separator, + 'text_qualifier': data.text_qualifier + }, + auth: { + username: user, + password: pass + }, + }; + requestModifiers(options); + debug(JSON.stringify(options)); + + request(options, (err, res, body) => { + if(body)debug("BODY:" + JSON.stringify(body)); + if(err)debug("ERR:" + JSON.stringify(err)); + if(res)debug("RES:" + JSON.stringify(res)); + + if(res && res.statusCode != 200){ + return callback(body,99) + } + + if (err) { + return callback(err,99) + } + if (body){ + return callback(body,0) + } + else{ + var error="unknown"; + return callback(error,98); + } + }); +} + function postUploadFile(restEndPoint,user,pass,timeout,data,filename,callback){ debug("postUploadFile Filename ["+ filename + "] to: " + restEndPoint); var options = { @@ -435,4 +484,4 @@ function custom(restEndPoint,user,pass,timeout,jsonBody,formBody,type,callback,c }); } -module.exports = { get, getPlain, post, put, del, postDownloadFile, postUploadFile, downloadFile, httpDelete, custom, addCookieToJar, displayCookies }; +module.exports = { get, getPlain, post, put, del, postDownloadFile, postUploadFile,uploadFileFormData, downloadFile, httpDelete, custom, addCookieToJar, displayCookies }; diff --git a/wmiocli.js b/wmiocli.js index 5934101..27b21fb 100644 --- a/wmiocli.js +++ b/wmiocli.js @@ -368,6 +368,55 @@ program.command('project-triggers-delete ') project.deleteTrigger(projectId, triggerId); }); + program.command('project-ref-data [ref-data-name]') + .description('lists/gets reference data in a project') + .action((projectId, refDataName) => { + checkOptions(); + //console.log(refDataName); + project.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint) + if(refDataName===undefined || refDataName===null || refDataName.length==0) + { + project.listRefData(projectId); + } + else + { + project.getRefData(projectId,refDataName); + } + }); + + program.command('project-ref-data-add [field-separator] [text-qualifier] [file-encoding]') + .description('Adds reference data') + .action((projectId, refDataName,refDataDescription,filename,fieldSeparator,textQualifier,fileEncoding) => { + checkOptions(); + if(fileEncoding===undefined || fileEncoding===null || fileEncoding.length==0){fileEncoding="UTF-8"}; + if(fieldSeparator===undefined || fieldSeparator===null || fieldSeparator.length==0){fieldSeparator=","}; + if(textQualifier===undefined || textQualifier===null || textQualifier.length==0){textQualifier='"'}; + + project.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint) + project.addRefData(projectId,refDataName,refDataDescription,filename,fieldSeparator,textQualifier,fileEncoding); + + }); + + program.command('project-ref-data-update [field-separator] [text-qualifier] [file-encoding]') + .description('Updates reference data') + .action((projectId, refDataName,refDataDescription,filename,fieldSeparator,textQualifier,fileEncoding) => { + checkOptions(); + if(fileEncoding===undefined || fileEncoding===null || fileEncoding.length==0){fileEncoding="UTF-8"}; + if(fieldSeparator===undefined || fieldSeparator===null || fieldSeparator.length==0){fieldSeparator=","}; + if(textQualifier===undefined || textQualifier===null || textQualifier.length==0){textQualifier='"'}; + + project.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint) + project.updateRefData(projectId,refDataName,refDataDescription,filename,fieldSeparator,textQualifier,fileEncoding); + }); + + + program.command('project-export ') + .description('Exports a project') + .action((projectId) => { + checkOptions(); + project.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint) + project.exportProj(projectId); + }); /** * ------------------------------------------------------------------------------------------------------------------------------------ From 7e7f0af8da315892015e4ff4d7f15c6e49dc04b4 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 Mar 2024 20:19:07 +0000 Subject: [PATCH 2/2] added messaging subscriber enable/disable --- experimental.js | 30 +++++++++++++++++++++++++++++- wmiocli.js | 8 ++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/experimental.js b/experimental.js index 5436284..c7f7412 100644 --- a/experimental.js +++ b/experimental.js @@ -29,6 +29,8 @@ var endDate; var startOrResume; var queueOrTopic; var messagingName; +var subscriberName; +var subscriberState; var nextUrl,formUrl; var finalCall; var loginStageCounter = 0; @@ -220,6 +222,23 @@ function getMonitorInfo(inExecutionStatus,inStartDate,inEndDate,inProjectId,inWo loginPhase1(); } +function messagingSubscriberEnable(inProjectId,inSubscriberName){ + messagingSubscriber(inProjectId,inSubscriberName,"ENABLED") +} + +function messagingSubscriberDisable(inProjectId,inSubscriberName){ + messagingSubscriber(inProjectId,inSubscriberName,"DISABLED") +} + +function messagingSubscriber(inProjectId,inSubscriberName,state){ + debug("Starting subscriber state change"); + projectId = inProjectId; + subscriberName = inSubscriberName; + subscriberState = state; + finalCall = processSubscriberState; + loginPhase1(); +} + function messagingDelete(inQueueOrTopic, inProjectId,inMessagingName) { projectId = inProjectId; @@ -714,6 +733,15 @@ function doMessagingCreate() rest.custom(endPoint,undefined,undefined,timeout,body,undefined,"POST",processResponse,undefined,headers,true,false); } +function processSubscriberState() +{ + debug("Messaging Subscriber State Change: " + subscriberState); + var endPoint = "https://" +domainName + "/integration/rest/messaging/subscribers/" + subscriberName + "?projectName=" + projectId + "&prop=state&value=" + subscriberState + "&force=false"; + debug("Next URL [" + endPoint + "]"); + var headers = setHeaders(); + rest.custom(endPoint,undefined,undefined,timeout,undefined,undefined,"PATCH",processResponse,undefined,headers,true,false); +} + function doMessagingDelete() { debug("Messaging Item Deletion") @@ -1097,5 +1125,5 @@ module.exports = {init, projectWorkflows,projectFlowservices, connectorAccounts,getProjectAccountConfig, getMonitorInfo,workflowResubmit, - messagingCreate,messagingStats,messagingDelete, + messagingCreate,messagingStats,messagingDelete, messagingSubscriber, vbidAnalysis, flowserviceScheduler,flowserviceOption,flowserviceDetails}; \ No newline at end of file diff --git a/wmiocli.js b/wmiocli.js index 27b21fb..151db11 100644 --- a/wmiocli.js +++ b/wmiocli.js @@ -793,6 +793,14 @@ program.command('experimental-messaging-stats ', { hidden: hi experimental.messagingStats(projectId, name); }); +program.command('experimental-messaging-subscriber ', { hidden: hideExperimental }) + .description('Set Subscriber Status') + .action((subscriberName, subscriberStatus, projectId) => { + checkOptions(); + experimental.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint) + experimental.messagingSubscriber(projectId, subscriberName, subscriberStatus); + }); + program.command('experimental-workflow-execution-analysis [format]', { hidden: hideExperimental }) .description('Provide workflow exedcution analysis') .action((vbid, format) => {