From 1b8e6bec1a242a46127e8e97300ea0f041aa097c Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 31 Mar 2020 09:11:04 -0300 Subject: [PATCH] fix(core.gbapp): Refactoring in MD fix in disabling auto-compiling of .gbapps. --- package-lock.json | 405 ++++++------------ package.json | 4 +- .../services/GBConversationalService.ts | 31 +- packages/core.gbapp/services/GBMinService.ts | 24 +- packages/default.gbui/package-lock.json | 54 ++- packages/kb.gbapp/services/KBService.ts | 7 +- .../services/WhatsappDirectLine.ts | 12 +- src/app.ts | 6 +- 8 files changed, 202 insertions(+), 341 deletions(-) diff --git a/package-lock.json b/package-lock.json index 658fd4a5..0ec1db2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -977,22 +977,6 @@ } } }, - "@babel/runtime-corejs2": { - "version": "7.7.7", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.7.7.tgz", - "integrity": "sha512-P91T3dFYQL7aj44PxOMIAbo66Ag3NbmXG9fseSYaXxapp3K9XTct5HU9IpTOm2D0AoktKusgqzN5YcSxZXEKBQ==", - "requires": { - "core-js": "^2.6.5", - "regenerator-runtime": "^0.13.2" - }, - "dependencies": { - "regenerator-runtime": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", - "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" - } - } - }, "@babel/template": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", @@ -1171,11 +1155,6 @@ "integrity": "sha512-FmuxfCuolpLl0AnQ2NHSzoUKWEJDFl63qXjzdoWBVyFCXzMGm1spBzk7LeHNoVCiWCF7mRVms9e6jEV9+MoPbg==", "dev": true }, - "@kyleshockey/object-assign-deep": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@kyleshockey/object-assign-deep/-/object-assign-deep-0.4.2.tgz", - "integrity": "sha1-hJAPDu/DcnmPR1G1JigwuCCJIuw=" - }, "@microsoft/microsoft-graph-client": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@microsoft/microsoft-graph-client/-/microsoft-graph-client-2.0.0.tgz", @@ -3118,9 +3097,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.17.tgz", - "integrity": "sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q==" + "version": "10.17.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.18.tgz", + "integrity": "sha512-DQ2hl/Jl3g33KuAUOcMrcAOtsbzb+y/ufakzAdeK9z/H/xsvkpbETZZbPNMIiQuk24f5ZRMCcZIViAwyFIiKmg==" } } }, @@ -3250,9 +3229,9 @@ } }, "botlib": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-1.4.2.tgz", - "integrity": "sha512-38e/6nA0+BlZZqDitXkJZhdQoyd1BGf0ActvMjk8SljqHp6mPTwN6kgnJSccFhMSJeFgOwu+bYC+R5RVUmS+mg==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-1.4.3.tgz", + "integrity": "sha512-XLE6ZarAYomTfTsOsU+UeK38ec/yTgJTakNFUqzxz51srpLC35HitKH2crUr6tHv3d6Q4wfTinhclRv+1HBONA==", "requires": { "async": "3.1.0", "botbuilder": "4.7.0", @@ -3266,8 +3245,8 @@ "pragmatismo-io-framework": "1.0.20", "reflect-metadata": "0.1.13", "sequelize": "5.21.5", - "sequelize-typescript": "^1.1.0", - "underscore": "^1.9.1", + "sequelize-typescript": "1.1.0", + "underscore": "1.9.1", "wait-until": "0.0.2", "winston": "3.2.1" }, @@ -3356,9 +3335,9 @@ } }, "btoa": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.1.2.tgz", - "integrity": "sha1-PkC4FmP4HS3WWWpMtxSo3BbPq+A=" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", + "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==" }, "btoa-lite": { "version": "1.0.0", @@ -4540,7 +4519,8 @@ "core-js": { "version": "2.6.8", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.8.tgz", - "integrity": "sha512-RWlREFU74TEkdXzyl1bka66O3kYp8jeTXrvJZDzVVMH8AiHUSOFpL1yfhQJ+wHocAm1m+4971W1PPzfLuCv1vg==" + "integrity": "sha512-RWlREFU74TEkdXzyl1bka66O3kYp8jeTXrvJZDzVVMH8AiHUSOFpL1yfhQJ+wHocAm1m+4971W1PPzfLuCv1vg==", + "dev": true }, "core-js-compat": { "version": "3.1.2", @@ -4683,15 +4663,6 @@ "capture-stack-trace": "^1.0.0" } }, - "cross-fetch": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-0.0.8.tgz", - "integrity": "sha1-Ae2U3EB98sAPGAf95wCnz6SKIFw=", - "requires": { - "node-fetch": "1.7.3", - "whatwg-fetch": "2.0.3" - } - }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -4932,19 +4903,6 @@ "type-detect": "^4.0.0" } }, - "deep-equal": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", - "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==", - "requires": { - "is-arguments": "^1.0.4", - "is-date-object": "^1.0.1", - "is-regex": "^1.0.4", - "object-is": "^1.0.1", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.2.0" - } - }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -5412,24 +5370,11 @@ "env-variable": "0.0.x" } }, - "encode-3986": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/encode-3986/-/encode-3986-1.0.0.tgz", - "integrity": "sha1-lA1RSY+HQa3hhLda0UObMXwMemA=" - }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "requires": { - "iconv-lite": "~0.4.13" - } - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -6031,14 +5976,6 @@ "micromatch": "^4.0.2" } }, - "fast-json-patch": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.1.0.tgz", - "integrity": "sha512-PipOsAKamRw7+CXtKiieehyjUeDVPJ5J7b2kdJYerEf6TSUQoD2ijpVyZ88KQm5YXziff4h762bz3+vzf56khg==", - "requires": { - "deep-equal": "^1.0.1" - } - }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", @@ -7438,11 +7375,6 @@ "is-decimal": "^1.0.0" } }, - "is-arguments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", - "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==" - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -7771,34 +7703,6 @@ "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==", "dev": true }, - "isomorphic-form-data": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-0.0.1.tgz", - "integrity": "sha1-Am9ifgMrDNhBPsyHVZKLlKRosGI=", - "requires": { - "form-data": "^1.0.0-rc3" - }, - "dependencies": { - "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "requires": { - "lodash": "^4.17.14" - } - }, - "form-data": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz", - "integrity": "sha1-rjFduaSQf6BlUCMEpm13M0de43w=", - "requires": { - "async": "^2.0.1", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.11" - } - } - } - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -8557,6 +8461,11 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, + "lodash-compat": { + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/lodash-compat/-/lodash-compat-3.10.2.tgz", + "integrity": "sha1-xpQBKKnTD46QLNLPmf0Muk7PwYM=" + }, "lodash.capitalize": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", @@ -9525,15 +9434,6 @@ "semver": "^5.7.0" } }, - "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } - }, "node-modules-regexp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", @@ -13683,16 +13583,6 @@ } } }, - "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==" - }, - "object-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.2.tgz", - "integrity": "sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ==" - }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -15391,21 +15281,16 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" + }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, - "querystring-browser": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/querystring-browser/-/querystring-browser-1.0.4.tgz", - "integrity": "sha1-8uNYgYQKgZvHsb9Zf68JeeZiLcY=" - }, "querystringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", @@ -15657,6 +15542,11 @@ "esprima": "~4.0.0" } }, + "reduce-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/reduce-component/-/reduce-component-1.0.1.tgz", + "integrity": "sha1-4Mk1QsV0UhvqE98PlIjtgqt3xdo=" + }, "reflect-metadata": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", @@ -15724,63 +15614,6 @@ "tslib": "^1.9.0" } }, - "regexp.prototype.flags": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", - "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0.tgz", - "integrity": "sha512-yYkE07YF+6SIBmg1MsJ9dlub5L48Ek7X0qz+c/CPCHS9EBXfESorzng4cJQjJW5/pB6vDF41u7F8vUhLVDqIug==", - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.1.5", - "is-regex": "^1.0.5", - "object-inspect": "^1.7.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.0", - "string.prototype.trimleft": "^2.1.1", - "string.prototype.trimright": "^2.1.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" - }, - "is-callable": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", - "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==" - }, - "is-regex": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", - "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", - "requires": { - "has": "^1.0.3" - } - } - } - }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", @@ -17085,24 +16918,6 @@ "strip-ansi": "^4.0.0" } }, - "string.prototype.trimleft": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", - "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", - "requires": { - "define-properties": "^1.1.3", - "function-bind": "^1.1.1" - } - }, - "string.prototype.trimright": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", - "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", - "requires": { - "define-properties": "^1.1.3", - "function-bind": "^1.1.1" - } - }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", @@ -17261,44 +17076,111 @@ } }, "swagger-client": { - "version": "3.9.6", - "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.9.6.tgz", - "integrity": "sha512-aS01VInNv6I+/DVQ++7TCwunYGWM/uiQNNPO0L+1+MfA3r0UEHYc9XJ8aXmrhXCvQ1jdY626ePch3plwhTunUQ==", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-2.1.18.tgz", + "integrity": "sha1-0zrd7Li438Qjh931t1pAXlQ32M8=", "requires": { - "@babel/runtime-corejs2": "^7.0.0", - "@kyleshockey/object-assign-deep": "^0.4.0", - "btoa": "1.1.2", - "buffer": "^5.1.0", - "cookie": "^0.3.1", - "cross-fetch": "0.0.8", - "deep-extend": "^0.5.1", - "encode-3986": "^1.0.0", - "fast-json-patch": "~2.1.0", - "isomorphic-form-data": "0.0.1", - "js-yaml": "^3.13.1", - "lodash": "^4.17.14", - "qs": "^6.3.0", - "querystring-browser": "^1.0.4", - "traverse": "^0.6.6", - "url": "^0.11.0", - "utf8-bytes": "0.0.1", - "utfstring": "^2.0.0" + "btoa": "^1.1.2", + "cookiejar": "^2.0.1", + "js-yaml": "^3.3.0", + "lodash-compat": "^3.5.0", + "q": "^1.4.1", + "superagent": "^1.2" }, "dependencies": { - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" }, - "deep-extend": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", - "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==" + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" }, - "traverse": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "extend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", + "integrity": "sha1-WkdDU7nzNT3dgXbf03uRyDpG8dQ=" + }, + "form-data": { + "version": "1.0.0-rc3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz", + "integrity": "sha1-01vGLn+8KTeuePlIqqDTjZBgdXc=", + "requires": { + "async": "^1.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.3" + } + }, + "formidable": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.0.16.tgz", + "integrity": "sha1-SRbP38TL7QILJXpqlQWpqzjCzQ4=" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "mime": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", + "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "qs": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz", + "integrity": "sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=" + }, + "readable-stream": { + "version": "1.0.27-1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.27-1.tgz", + "integrity": "sha1-a2eYPCA1fO/QfwFlABoW1xDZEHg=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "superagent": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-1.8.5.tgz", + "integrity": "sha1-HA3cOvMOgOuE68BcshItqP6UC1U=", + "requires": { + "component-emitter": "~1.2.0", + "cookiejar": "2.0.6", + "debug": "2", + "extend": "3.0.0", + "form-data": "1.0.0-rc3", + "formidable": "~1.0.14", + "methods": "~1.1.1", + "mime": "1.3.4", + "qs": "2.3.3", + "readable-stream": "1.0.27-1", + "reduce-component": "1.0.1" + }, + "dependencies": { + "cookiejar": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.0.6.tgz", + "integrity": "sha1-Cr81atANHFohnYjURRgEbdAmrP4=" + } + } } } }, @@ -18252,22 +18134,6 @@ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - } - } - }, "url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -18296,16 +18162,6 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, - "utf8-bytes": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/utf8-bytes/-/utf8-bytes-0.0.1.tgz", - "integrity": "sha1-EWsCVEjJtQAIHN+/H01sbDfYg30=" - }, - "utfstring": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utfstring/-/utfstring-2.0.1.tgz", - "integrity": "sha512-x8lx0NGB2OUxOOvFE3z4feOpJWrVrllGRzJq4h6H70bh3sincW+LAlexHBFD5jzV9sZ5qcabZcCwA7ZD6MdUkg==" - }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", @@ -18464,11 +18320,6 @@ "integrity": "sha1-eWkVhNmGB/UHC9O3CkDmuyLkAes=", "dev": true }, - "whatwg-fetch": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", - "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=" - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index e59a3cb0..2213e25c 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "botbuilder-ai": "4.7.0", "botbuilder-dialogs": "4.7.0", "botframework-connector": "4.7.0", - "botlib": "1.4.2", + "botlib": "1.4.4", "chai": "4.2.0", "cli-spinner": "0.2.10", "csv-parse": "4.8.3", @@ -92,7 +92,7 @@ "simple-git": "1.129.0", "sppull": "2.5.1", "strict-password-generator": "1.1.2", - "swagger-client": "3.9.6", + "swagger-client": "2.1.18", "tedious": "6.6.5", "typedoc": "0.15.6", "typescript": "3.7.4", diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 67806d21..ee18937b 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -42,6 +42,7 @@ import { GBDialogStep, GBLog, GBMinInstance, IGBConversationalService, IGBCoreSe import { AzureText } from 'pragmatismo-io-framework'; import { Messages } from '../strings'; import { GBServer } from '../../../src/app'; +import { GBWhatsappPackage } from '../../whatsapp.gblib'; const urlJoin = require('url-join'); const PasswordGenerator = require("strict-password-generator").default; const Nexmo = require('nexmo'); @@ -80,8 +81,10 @@ export class GBConversationalService implements IGBConversationalService { return step.context.activity.locale; } - public async sendFile(min: GBMinInstance, step: GBDialogStep, url: string): Promise { - const mobile = step.context.activity.from.id; + public async sendFile(min: GBMinInstance, step: GBDialogStep, mobile: string, url: string, caption: string): Promise { + if (step !== null) { + mobile = step.context.activity.from.id; + } const filename = url.substring(url.lastIndexOf('/') + 1); await min.whatsAppDirectLine.sendFileToDevice(mobile, url, filename); @@ -124,12 +127,7 @@ export class GBConversationalService implements IGBConversationalService { } public async sendToMobile(min: GBMinInstance, mobile: string, message: string) { - - // HACK: Gets the sendToDevice method of whatsapp.gblib and setups scheduler. - - const whatsappChannel = (min.packages[6] as any).getChannel(); - const sendToDevice = whatsappChannel.sendToDevice.bind(whatsappChannel); - sendToDevice(mobile, message); + min.whatsAppDirectLine.sendToDevice(mobile, message); } // tslint:enable:no-unsafe-any @@ -152,6 +150,7 @@ export class GBConversationalService implements IGBConversationalService { let state = State.InText; let currentImage = ''; let currentText = ''; + let currentCaption = ''; //![General Bots](/instance/images/gb.png) for (var i = 0; i < text.length; i++) { @@ -169,12 +168,12 @@ export class GBConversationalService implements IGBConversationalService { case State.InImageBegin: if (c === '[') { if (currentText !== '') { - if (mobile === null) { + if (mobile === null) { await step.context.sendActivity(currentText); } - else{ + else { this.sendToMobile(min, mobile, currentText); - } + } await sleep(3000); } currentText = ''; @@ -189,6 +188,9 @@ export class GBConversationalService implements IGBConversationalService { if (c === ']') { state = State.InImageAddressBegin; } + else { + currentCaption = currentCaption.concat(c); + } break; case State.InImageAddressBegin: if (c === '(') { @@ -199,7 +201,8 @@ export class GBConversationalService implements IGBConversationalService { if (c === ')') { state = State.InText; let url = urlJoin(GBServer.globals.publicAddress, currentImage); - await this.sendFile(min, step, url); + await this.sendFile(min, step, mobile, url, currentCaption); + currentCaption = ''; await sleep(5000); currentImage = ''; } @@ -211,10 +214,10 @@ export class GBConversationalService implements IGBConversationalService { } if (currentText !== '') { - if (mobile === null) { + if (mobile === null) { await step.context.sendActivity(currentText); } - else{ + else { this.sendToMobile(min, mobile, currentText); } } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 51e2640a..5df8df88 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -114,7 +114,7 @@ export class GBMinService { if (process.env.DISABLE_WEB !== 'true') { let url = GBServer.globals.wwwroot ? GBServer.globals.wwwroot : - urlJoin(GBDeployer.deployFolder, GBMinService.uiPackage, 'build'); + urlJoin(GBDeployer.deployFolder, GBMinService.uiPackage, 'build'); GBServer.globals.server.use('/', express.static(url)); } @@ -544,14 +544,17 @@ export class GBMinService { private async processMessageActivity(context, min: GBMinInstance, step: GBDialogStep) { - // Adds message to the analytics layer. + if (process.env.PRIVACY_STORE_MESSAGES === "true") { - const analytics = new AnalyticsService(); - const user = await min.userProfile.get(context, {}); - analytics.createMessage(min.instance.instanceId, - user.conversation, user.systemUser, - context.activity.text); + // Adds message to the analytics layer. + const analytics = new AnalyticsService(); + const user = await min.userProfile.get(context, {}); + analytics.createMessage(min.instance.instanceId, + user.conversation, user.systemUser, + context.activity.text); + } + // Checks for global exit kewywords cancelling any active dialogs. const globalQuit = (locale, utterance) => { @@ -568,7 +571,12 @@ export class GBMinService { } else if (isVMCall) { await GBMinService.callVM(context.activity.text, min, step); } else if (context.activity.text.charAt(0) === '/') { - await step.beginDialog(context.activity.text); + let text = context.activity.text; + let parts = text.split(' '); + let dialogName = parts[0]; + parts.splice(0, 1); + let args = parts.join(' '); + await step.beginDialog(dialogName, { args: args }); } else if (globalQuit(step.context.activity.locale, context.activity.text)) { await step.cancelAllDialogs(); diff --git a/packages/default.gbui/package-lock.json b/packages/default.gbui/package-lock.json index 9ad7cc42..ee732c70 100644 --- a/packages/default.gbui/package-lock.json +++ b/packages/default.gbui/package-lock.json @@ -1,6 +1,6 @@ { "name": "default.gbui", - "version": "0.0.12", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2818,15 +2818,6 @@ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, - "browser-id": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/browser-id/-/browser-id-1.1.0.tgz", - "integrity": "sha512-MuvthhJ8pDjIYpJzHwYOrlFtTPhEOF3wk9AVvy19pLQwmS/OdGWptuhzjkgLnDJS3WgV2m7bLDvlCwufg1jWBA==", - "requires": { - "uuid": "^3.3.3", - "versioned-storage": "^1.1.0" - } - }, "browser-process-hrtime": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", @@ -6067,11 +6058,6 @@ "locate-path": "^3.0.0" } }, - "fingerprintjs2": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fingerprintjs2/-/fingerprintjs2-2.1.0.tgz", - "integrity": "sha512-H1k/ESTD2rJ3liupyqWBPjZC+LKfCGixQzz/NDN4dkgbmG1bVFyMOh7luKSkVDoyfhgvRm62pviNMPI+eJTZcQ==" - }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -7653,7 +7639,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -7690,7 +7677,8 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -7699,7 +7687,8 @@ }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -7802,7 +7791,8 @@ }, "inherits": { "version": "2.0.4", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -7812,6 +7802,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7831,11 +7822,13 @@ }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.9.0", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7852,6 +7845,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7932,7 +7926,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7942,6 +7937,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -8017,7 +8013,8 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -8047,6 +8044,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -8064,6 +8062,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -8102,11 +8101,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.1.1", - "bundled": true + "bundled": true, + "optional": true } } } @@ -14282,11 +14283,6 @@ "extsprintf": "^1.2.0" } }, - "versioned-storage": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/versioned-storage/-/versioned-storage-1.1.0.tgz", - "integrity": "sha512-oS+unMiWJjaVAFCkNJvmHiu6LDb8KrzT8YmfrQpAmn8/yKnW4Roq3lcVMxQofT9Oidqg8oWChbGYl4FGQJyPPg==" - }, "vfile": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz", diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 03b41e13..dd721ab3 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -98,7 +98,7 @@ export class KBService implements IGBKBService { return out.join(' '); } - public async getAnswerTextByMediaName(instanceId: number, answerMediaName: string): Promise{ + public async getAnswerTextByMediaName(instanceId: number, answerMediaName: string): Promise { const answer = await GuaribasAnswer.findOne({ where: { instanceId: instanceId, @@ -106,7 +106,7 @@ export class KBService implements IGBKBService { } }); - return answer.content; + return answer != null ? answer.content : null; } public async getQuestionById(instanceId: number, questionId: number): Promise { @@ -406,8 +406,7 @@ export class KBService implements IGBKBService { else if (channel === 'whatsapp') { await conversationalService.sendMarkdownToMobile(min, step, null, answer.content); } - else - { + else { await step.context.sendActivity(html); } } diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index eb865719..ced4e656 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -68,12 +68,13 @@ export class WhatsappDirectLine extends GBService { this.whatsappServiceUrl = whatsappServiceUrl; const fs = require('fs'); - this.directLineClient = + let directLineClient = new Swagger({ spec: JSON.parse(fs.readFileSync('directline-3.0.json', 'utf8')), usePromise: true }); - this.directLineClient + this.directLineClient = directLineClient; + directLineClient .then(async client => { client.clientAuthorizations.add( @@ -231,7 +232,7 @@ export class WhatsappDirectLine extends GBService { return `${attachment.content.title} - ${attachment.content.text}`; } - public async sendFileToDevice(to, url, filename) { + public async sendFileToDevice(to, url, filename, caption) { const options = { method: 'POST', url: urlJoin(this.whatsappServiceUrl, 'sendFile'), @@ -239,7 +240,8 @@ export class WhatsappDirectLine extends GBService { token: this.whatsappServiceKey, phone: to, body: url, - filename: filename + filename: filename, + caption: caption }, headers: { 'cache-control': 'no-cache' @@ -262,7 +264,7 @@ export class WhatsappDirectLine extends GBService { qs: { token: this.whatsappServiceKey, phone: to, - audio:url + audio: url }, headers: { 'cache-control': 'no-cache' diff --git a/src/app.ts b/src/app.ts index 8c9856f4..f5c7098d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -51,6 +51,7 @@ import { GBCoreService } from '../packages/core.gbapp/services/GBCoreService'; import { GBDeployer } from '../packages/core.gbapp/services/GBDeployer'; import { GBImporter } from '../packages/core.gbapp/services/GBImporterService'; import { GBMinService } from '../packages/core.gbapp/services/GBMinService'; +import { GBWhatsappPackage } from '../packages/whatsapp.gblib'; /** * Global shared server data; @@ -114,7 +115,7 @@ export class GBServer { const deployer: GBDeployer = new GBDeployer(core, importer); const azureDeployer: AzureDeployerService = new AzureDeployerService(deployer); const adminService: GBAdminService = new GBAdminService(core); - const conversationalService: GBConversationalService = new GBConversationalService(core); + if (process.env.NODE_ENV === 'development') { const proxy = GBConfigService.get('REVERSE_PROXY'); @@ -173,7 +174,8 @@ export class GBServer { } // Builds minimal service infrastructure. - + + const conversationalService: GBConversationalService = new GBConversationalService(core); const minService: GBMinService = new GBMinService(core, conversationalService, adminService, deployer); GBServer.globals.minService = minService; await minService.buildMin(instances);