From c70200a17624e15d9408d00c8b67783057c1ae06 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 11 Feb 2019 11:25:00 -0200 Subject: [PATCH 01/32] fix(kb.gbapp): FAQ now showing again. fix(kb.gbapp): When menu is clicked it will show associated FAQ again. --- packages/kb.gbapp/services/KBService.ts | 180 +++++++++--------------- 1 file changed, 70 insertions(+), 110 deletions(-) diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 614d1876..231dd7f8 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -60,7 +60,6 @@ export class KBServiceSearchResults { } export class KBService { - public sequelize: Sequelize; constructor(sequelize: Sequelize) { @@ -68,7 +67,9 @@ export class KBService { } public static getFormattedSubjectItems(subjects: GuaribasSubject[]) { - if (!subjects) { return ''; } + if (!subjects) { + return ''; + } const out = []; subjects.forEach(subject => { out.push(subject.title); @@ -86,10 +87,7 @@ export class KBService { return out.join(' '); } - public async getQuestionById( - instanceId: number, - questionId: number - ): Promise { + public async getQuestionById(instanceId: number, questionId: number): Promise { return GuaribasQuestion.findOne({ where: { instanceId: instanceId, @@ -98,10 +96,7 @@ export class KBService { }); } - public async getAnswerById( - instanceId: number, - answerId: number - ): Promise { + public async getAnswerById(instanceId: number, answerId: number): Promise { return GuaribasAnswer.findOne({ where: { instanceId: instanceId, @@ -110,11 +105,7 @@ export class KBService { }); } - public async getAnswerByText( - instanceId: number, - text: string - ): Promise { - + public async getAnswerByText(instanceId: number, text: string): Promise { const Op = Sequelize.Op; const question = await GuaribasQuestion.findOne({ @@ -139,14 +130,15 @@ export class KBService { } public async addAnswer(obj: GuaribasAnswer): Promise { - return new Promise( - (resolve, reject) => { - GuaribasAnswer.create(obj).then(item => { + return new Promise((resolve, reject) => { + GuaribasAnswer.create(obj) + .then(item => { resolve(item); - }).error((reason) => { + }) + .error(reason => { reject(reason); }); - }); + }); } public async ask( @@ -155,7 +147,6 @@ export class KBService { searchScore: number, subjects: GuaribasSubject[] ): Promise { - // Builds search query. query = query.toLowerCase(); @@ -181,11 +172,8 @@ export class KBService { instance.searchIndexer ); const results = await service.search(query); - if (results && results.length > 0 && - results[0]['@search.score'] >= searchScore) { - const value = await this.getAnswerById( - instance.instanceId, - results[0].answerId); + if (results && results.length > 0 && results[0]['@search.score'] >= searchScore) { + const value = await this.getAnswerById(instance.instanceId, results[0].answerId); if (value) { return Promise.resolve({ answer: value, questionId: results[0].questionId }); } else { @@ -195,8 +183,7 @@ export class KBService { } else { const data = await this.getAnswerByText(instance.instanceId, query); if (data) { - return Promise.resolve( - { answer: data.answer, questionId: data.question.questionId }); + return Promise.resolve({ answer: data.answer, questionId: data.question.questionId }); } else { return Promise.resolve({ answer: null, questionId: 0 }); } @@ -206,10 +193,7 @@ export class KBService { } } - public async getSubjectItems( - instanceId: number, - parentId: number - ): Promise { + public async getSubjectItems(instanceId: number, parentId: number): Promise { const where = { parentSubjectId: parentId, instanceId: instanceId }; return GuaribasSubject.findAll({ @@ -218,11 +202,16 @@ export class KBService { } public async getFaqBySubjectArray(from: string, subjects: any): Promise { - const where = { - from: from, subject1: null, subject2: null, subject3: null, subject4: null - }; if (subjects) { + const where = { + from: from, + subject1: null, + subject2: null, + subject3: null, + subject4: null + }; + if (subjects[0]) { where.subject1 = subjects[0].internalId; } @@ -238,11 +227,15 @@ export class KBService { if (subjects[3]) { where.subject4 = subjects[3].internalId; } - } - return await GuaribasQuestion.findAll({ - where: where - }); + return await GuaribasQuestion.findAll({ + where: where + }); + } else { + return await GuaribasQuestion.findAll({ + where: { from: from } + }); + } } public async importKbTabularFile( @@ -250,19 +243,17 @@ export class KBService { instanceId: number, packageId: number ): Promise { - const file = Fs.readFileSync(filePath, 'UCS-2'); const opts = { delimiter: '\t' }; - let lastQuestion: GuaribasQuestion; + let lastQuestionId: number; let lastAnswer: GuaribasAnswer; const data = await parse(file, opts); return asyncPromise.eachSeries(data, async line => { - // Extracts values from columns in the current line. const subjectsText = line[0]; @@ -318,7 +309,7 @@ export class KBService { content: answer, format: format, packageId: packageId, - prevId: lastQuestion ? lastQuestion.questionId : 0 + prevId: lastQuestionId ? lastQuestionId : 0 }); const question1 = await GuaribasQuestion.create({ @@ -334,16 +325,14 @@ export class KBService { packageId: packageId }); - if (lastAnswer && lastQuestion) { - await lastAnswer.updateAttributes({ nextId: lastQuestion.questionId }); + if (lastAnswer && lastQuestionId) { + await lastAnswer.updateAttributes({ nextId: lastQuestionId }); } lastAnswer = answer1; - lastQuestion = question1; - - return Promise.resolve(lastQuestion); + lastQuestionId = question1.questionId; + return Promise.resolve(question1.questionId); } else { - // Skips the header. return Promise.resolve(null); @@ -351,16 +340,13 @@ export class KBService { }); } - public async sendAnswer(conversationalService: IGBConversationalService, - step: any, answer: GuaribasAnswer) { - + public async sendAnswer(conversationalService: IGBConversationalService, step: any, answer: GuaribasAnswer) { if (answer.content.endsWith('.mp4')) { await conversationalService.sendEvent(step, 'play', { playerType: 'video', data: answer.content }); - } else if (answer.content.length > 140 && - step.context._activity.channelId === 'webchat') { + } else if (answer.content.length > 140 && step.context._activity.channelId === 'webchat') { const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].will_answer_projector); // TODO: Handle rnd. @@ -380,13 +366,15 @@ export class KBService { }); html = marked(answer.content); } - await conversationalService.sendEvent(step, 'play', - { - playerType: 'markdown', data: { - content: html, answer: answer, - prevId: answer.prevId, nextId: answer.nextId - } - }); + await conversationalService.sendEvent(step, 'play', { + playerType: 'markdown', + data: { + content: html, + answer: answer, + prevId: answer.prevId, + nextId: answer.nextId + } + }); } else { await step.context.sendActivity(answer.content); await conversationalService.sendEvent(step, 'stop', null); @@ -398,47 +386,28 @@ export class KBService { packageStorage: GuaribasPackage, instance: IGBInstance ): Promise { - // Imports subjects tree into database and return it. - await this.importSubjectFile( - packageStorage.packageId, - UrlJoin(localPath, 'subjects.json'), - instance); + await this.importSubjectFile(packageStorage.packageId, UrlJoin(localPath, 'subjects.json'), instance); // Import all .tsv files in the tabular directory. - return this.importKbTabularDirectory( - localPath, - instance, - packageStorage.packageId + return this.importKbTabularDirectory(localPath, instance, packageStorage.packageId); + } + + public async importKbTabularDirectory(localPath: string, instance: IGBInstance, packageId: number): Promise { + const files = await walkPromise(UrlJoin(localPath, 'tabular')); + + return Promise.all( + files.map(async file => { + if (file.name.endsWith('.tsv')) { + return this.importKbTabularFile(UrlJoin(file.root, file.name), instance.instanceId, packageId); + } + }) ); } - public async importKbTabularDirectory( - localPath: string, - instance: IGBInstance, - packageId: number - ): Promise { - - const files = await walkPromise(UrlJoin(localPath, 'tabular')); - - return Promise.all(files.map(async file => { - if (file.name.endsWith('.tsv')) { - return this.importKbTabularFile( - UrlJoin(file.root, file.name), - instance.instanceId, - packageId); - } - })); - - } - - public async importSubjectFile( - packageId: number, - filename: string, - instance: IGBInstance - ): Promise { + public async importSubjectFile(packageId: number, filename: string, instance: IGBInstance): Promise { const subjects = JSON.parse(Fs.readFileSync(filename, 'utf8')); const doIt = async (subjects: GuaribasSubject[], parentSubjectId: number) => { @@ -466,12 +435,7 @@ export class KBService { return doIt(subjects.children, null); } - public async undeployKbFromStorage( - instance: IGBInstance, - deployer: GBDeployer, - packageId: number - ) { - + public async undeployKbFromStorage(instance: IGBInstance, deployer: GBDeployer, packageId: number) { await GuaribasQuestion.destroy({ where: { instanceId: instance.instanceId, packageId: packageId } }); @@ -489,23 +453,19 @@ export class KBService { } /** - * Deploys a knowledge base to the storage using the .gbkb format. - * - * @param localPath Path to the .gbkb folder. - */ + * Deploys a knowledge base to the storage using the .gbkb format. + * + * @param localPath Path to the .gbkb folder. + */ public async deployKb(core: IGBCoreService, deployer: GBDeployer, localPath: string) { const packageType = Path.extname(localPath); const packageName = Path.basename(localPath); logger.info(`[GBDeployer] Opening package: ${localPath}`); - const packageObject = JSON.parse( - Fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8') - ); + const packageObject = JSON.parse(Fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8')); const instance = await core.loadInstance(packageObject.botId); logger.info(`[GBDeployer] Importing: ${localPath}`); - const p = await deployer.deployPackageToStorage( - instance.instanceId, - packageName); + const p = await deployer.deployPackageToStorage(instance.instanceId, packageName); await this.importKbPackage(localPath, p, instance); deployer.rebuildIndex(instance); From f67f04a4ba703ad5571ad75102962f76492ed94b Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 11 Feb 2019 13:21:44 -0200 Subject: [PATCH 02/32] fix(design): 404 on bot logo on default.gbtheme: https://github.com/GeneralBots/BotServer/issues/80. --- packages/default.gbtheme/css/SidebarMenu.css | 2 +- packages/default.gbtheme/images/bot-logo.png | Bin 20693 -> 25302 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/default.gbtheme/css/SidebarMenu.css b/packages/default.gbtheme/css/SidebarMenu.css index 65f9612b..b898ac9a 100644 --- a/packages/default.gbtheme/css/SidebarMenu.css +++ b/packages/default.gbtheme/css/SidebarMenu.css @@ -81,7 +81,7 @@ html[dir="ltr"] .ms-Nav-compositeLink.is-selected a:after { position: absolute; top: 0; left: 0; - background-image: url(../images/logo_General_BotS.png); + background-image: url(../images/bot-logo.png); background-position: 2px 2px; background-repeat: no-repeat; background-size: contain; diff --git a/packages/default.gbtheme/images/bot-logo.png b/packages/default.gbtheme/images/bot-logo.png index ff451eeebbbbc1dfbae882ef52c47c0f9fc26b58..68f43a6c2847bc355fcb4f48895932c957233e45 100644 GIT binary patch delta 9913 zcmcJVXEa>x_xHy{mjn|ni56Y-PIS=;5s4mUM2pdr=nf)x7@{S5jReW9w?QyUW|R;U z5e$Q2^ccM}#^d+mdHY-Izn1sa?aom_$$viNutD0vtzdxF-*pfHH zKFD|r7lP4Hdl^>$rvF3D-KrlUef@R$AK>vx**U*||9jeVK~47VnK^U%mcs$dIghM!jWVN{)IbWa60Z; z!N3VJEv}MM8Ou*zZLopzRGyMN+`Y;1+VfR7zbz|M2PqO;yGV zp4GENClX=Q753cawvQR+AFs|3Bm1n{twx_WGkXEKzY{SZ1oIXqxbwm|-yO(H+HdsN zHHJ#A1NW~Ft_WTbgXE?5vykN|KrwW--ej<)i8%Gcox-q|d^*vIJliX}Anj)tmnL!u zdpey>P0U7~uR8%pV>M9+1O1|i3ml$&xXB0{f49^$IQe0X+}(W5s1b5+wuro69^830 zvqkon#-cL)BG>IN+-PvX#Tj1nM9yuhh74f)trU6mIQIwsx$InudEbl)v_k6VdQ-QD z<^?C__~%HU5_0EVd0lRwFxH%hSSaLLd!f{M@^h0M&g6>N{K*i-q2#(Tvd#_dVeC5| zbRz#AazlPLuN(10Isd2u&ezK|l36~IQ4jEkDNmtXZSBdtysx}W6c8B?z)auMftI8j zwX@av^PCGTv*BAEM?6=cnr7s`)}3K@D?hDXCVD}(1Vx?U@W`_h3_x}=;-)xW{ghHj z%)b8N+1b+NR5Wg};7XkkyLnZ*%OcdL@69zr;fbFErmuaxU@S8l==Iv&m-a1+Je(Yr z2?uX)_yK1#!N|P=VVvFS>lWbeC&5_!`DQRaaw{BvmLj78Z$Cy$MeVTcsmEVCLob{k z;Q_e$Adk$-Yw}W|!?Kf~_FUH{Ig83B3d`ehDn3&5UPr~Jv* zFcl}NLM|TEcQd__qL95IDd-mqvp@6yk`WIp~l7*a9iR1Eggo^9Nw5cT`0u zc$|Jw4n@{!tLo1ELO8=6uciEB=7`4Bn2E zYEm~TWEq-DYRwY!8O!oPkJd}CELXMg_4JmrX(;)68wpbQ1iL-bq_JJDL4V+Z>VRTp zFfU82)XM7E_pI=zV|{5lPh+ck>jW1g5JM?XVfi)pjx#lY!{qrA(5mUq-N443nquNrJc z9e?N1PzZRLJPQ|-4R22UtUh0uzEPbtI2QkoFT2+cDVod{F>f7lWVh2C_)vSzplD#p z(RaYDf}wR0XgzmGG_w5M5s)d?>iq9cAL8cs6Xm+WLmq&%V<}nt?p-o7v-78@$+}D@ z3AQ7q#=?J2_ZAW>~W)NGbHK|4f$P(^c12jh$NN|MRAACnhEi#!{wd?NLyt#OS%k*y9C&JiF8qtQ$;VQz0VIEv>*=DpWe(QQ zn>h1ESwR#Zm^zB-?p-OPFz%r*S+T7SP1&h(KJ+J*zG8WuWf>#pIjQJp@8#3!aUpu> z&Ds>;2~-Kel-Lv7m~m>);bmEtyHaRpdt_4_1j=VnF83ue%RT7j9ry4Y+-)bj5d8D+ zFKOOeS#iZB9E*mf{C!xp@wKK_1Y}gKa(yv6Xz2i{^{7OAl*3R^{n4ZZhltr3^~W*s zg=XqbR{xm%!agoKhuY5$^56CR>kVIp$`Jz)mi|$FN^aFnaILCRQiL_Y>CK@?@|e7&gIxl zXV1}dS+ToGRy~uBvQ5bcQ?&_S2AV2C%K-x+s^*1-ol>k7k&RZ@_h;XdtKsi=T(=xP zg!kJ9q~0EQzqsqjMpe90Tr41skYRHF+T`APm|knqWB-O@NR;{^Q#ksi$8nETf^P<( zV9uG4x`!6c@!|vREh36S7XPe{^ecx=-zyt+h>}Qp6EMvW?#})ycA&>{1n(*V?SmVH zyA1ptVpf|%Wu#of8$K@<@!Ra#216Qw`O81w9jQklp^KfTZkN z34X@Cesc9^aLH!l;PaqC>}h-R&nYBe-AyCLj#pzk$S-N?E!QIrt6vW%I#zxz)oBZ) zlYhGhPOAxD{&_%!gP|dV8WO;US`e zwQnRL@Lc9slDLZAxkAMZk~ZY2chk=!mOf1!ZY;@a+9SjKMEj0dR@n$V%z%G)K44XC z+jKx=BrYD!vidYz(+~x#ub5{16O%Mn;^^_K2t=!2VFbp(-l)SYldP}b;sZ&jDwwo2 zbu%CuI&NDKE4J96_}i;2T@j+5_Gq87Utw~3W>*d+1&eMk2sM}04gb`t8sp+Q9$;MP z{4j`MZdRG~L(}eV!3r_+z$Xnkm!;eC8p|v$UeJE*0nB&grzy=Em-v7{LPT{-APwuM zYkzEIJv+u3bQq25t(6f>ABhS@eobSq4qYm`eFYWE2GskqIr6M@`~>9&X0rRHYz~L> zEU~%gu=RlC4OFFIJoH!MrzuaaV8%L`9->ZRMq+9EUfAKk65u&^fJf=N-gel_*5GMt zD(9#-DzqG~T+$S5Of`|Ol#cmr!^*+I_la~~QeJ{X?S?nP=@iVD)mN=?QwHwbJtN){ zb@vzmuI7ngqS7IB^2P;LLxNj|IN33dw~|e+CY;%Am1~}_wV7+4@8g|zN|BuAK3~!K zhmEx}v(x0?7o4TU(jRtd=cP*UQ2jeL#r+}iN^M6_qZdyM|CHUMwfoMn^#hWs zOOfblzA%0Aa(2}MHCn0To3A|r5hp=Wgj4h*h`3fTtf^SuperdZ{R*SzW2P{NCG z4}Q0o#6qBoUiw^!8o_@2X*+U*G1l;riJD@f*coS*UzLk2c9_}HCjI+idN3Rnw5j$$ zZPf{1RmW;SXjaE07g-4!a<5DXj?lXEY?L;0zD3I#k^yt zFzmEkj8}u9A790ONT7lZTzfD&eGSUKW_|6+3Qkf*kkkh+L%k%1BGa_XMiQe3d4brrTTF%I0c)Bm{=+Sjj!Y zH16lP9%&R2A_rWwZtREVjZV4yF{s-EO!g(6kzi!eIx+eJ4q znd&Hk$SHt)Qi#al?{f(k;ye-ETC6x)4#BKs?$ApGY@quN0|n29^h)($yUIRQu3a+N z^%sJQlbuZ+NAg9u;lo3moVNMofk(ICYg?hg&jOCl(Q%N^L)F904X~X;-Y{TOeK2?S z1k1*mvH%Yp^$c@XITcJ{&6!G?4TsL zi;S5w2lJJV@t3i=K9sC`nB?M4&P1-$yoEhS|1d?b~)7dKT?;|6R%Yih}m?c;JMzkk6!!pYODW{AvE|lY@fIme?>QEvmbR zBfCdz;4aFTAfWwhQvL1R68G-3jsr_DN}UvFeO(xs`Lq?x1(4n!G<4z2F4jey7&;lnPVev7pmZjng`FjOy}Mg}s1{1;%UVd(hU#`AZv% zb^&*i75QH2K?QQ{-$UPN9T25K9<@|Rik7EdfWdAMfo*qUrB%{j$+u33ne+MN0@2(e zk)V=RR5c(5^v{%HoZjF2DhZEieFLgIPm629BocAYx`AiW1g@xSe>o~6{WSUzaT6DUOiGvoi~N-_0AO(DWzCBHJF~f7#C!ZUhpakia%X@=Iq!FR z3ti4xTlqzPg8{rKWc54aed0pVJx|i;>~0PBiNtln-?W;Y$ag67LglBX?T`i%VY3M- zNhUU63dw6Cs`j;`nt2D`i`y)~zqEVKi5{9~!6VJ7FQQiG`;0qy!mwGX+ZZCCpjThU zMC!|)1!Te=A8$4amp|}L`1zwR+xH~Rno!9%XIPiYP$cOIlT#XmKpDvQ12ep1u#tpmoDv*K=Ym4qsYCU?UpJ{^$sP-Jsszt6~g3rU#t?Qy#tC_7YBCv~zb&~n7&`c__yV>(u$U~bztGt~cyi3VLbka(mo^M%ZJ()ycSL4Ab(poJGSg%hJXO0Ube9RoA? zsG)>pRYgEB%7jXCc~hU|J|=~h%|b|8UFH%FMEgAgU5z6sNt>Vn1A)2{IH+>c&%Q3S zx>Hq39h>&VLf7ykM;2|2fnL_mkm!W>XKTV7);<~I+sev}9pq=|%2TD1o}=zbI)I>S zm@=mvSsrFi*%PgwL4N%{Qh~p_hI*`KN%9wu1*(3{ELVtvbHVYZ2+knM{Od=W%pXhX5AIP9Yf)U2g zciLq2P?jWGtGGYw@f1#F0T1dDGXnmgfQNe|IL9qKNj^s+{Hr%e=|1?TA$u>&#<)&_ z?8bLLvI1Rt;?wZcq<9fC_T1k^ajE+rBh5KZ+E1x2mK%0%?tj8g-n^juHbIbOwd#AY z=SYdQ5s1oRY6pb=A^xVhUCohbu<(E$lWO>iflRuqsMB*l(-JlcppF zN<~py*TW>P<0cK}h3l%t#SI&=LJ3X$bg*!$uor9J;*hLgktu9hkt{au8~cKV2B&#Y zKqJv5ZfZ~6)$Jaa=ijLX zPl-trU97ECBIKy8aXFWHRE{Iqg4{1E(0geid*Ip(fwnjWeqxT%FmH^Yb7mvlogsZ% z0~VD`U{py)G}S&L(K~4)QM{T=KrE@H^-mJhwad@w2w@H;2f>+3WUt;A)gmWi2;$7)W*oO?(2x69>F)b3ZTvK~EE|w2JIy#g9j__%ui>d<>64hCb-Xok1+|m( zG{K0jOD;g5_U4CAhO|a)kDY50O48fIJs#`jPnuBVb)%lsU4HZ9b+zIRh7&u45FG*a zP}>_76MPk4M~)oj>VtGcgrDgb@t97 zvVCSJ><T!`e`aurNYh{wKzE{bn2CvxY=wzir zEX}@|;42sLAQ*xgn-TQNf}q&6MU~P0I^lUfkU<&~7ow9DvG(dEDwpBH0J_n^( z0YJX0)_m3i4WlfEx!%2xT=W(@YE~={JjGfH+bi!Y6hEc>4w1p@@d!pT#}tZE`<^Nk z`xF%2^H6stTh6aztW|>zDC`UUPVQDvG0(3U@I>zKM{9&&QZVQ+1niC*64h!cs=xfUl#YTR{tGXPX!t3(hUS)QYc?A22m8pC2#zF zA+>5^I7K?hZ{tU{N(a9fTc~bH(ImIzM7y)EkWr+5W%x%M_}YxcXVi<7RCiYWITlUL z6`gNFAZup(L-MLu!b~|RU6*g!`{RlvneC7HrL=p^CsH+8_110usg%vn`K*{(U;)qR z`scRrR^CZUGCz)6Fmv}=MU|-Ho6Iq2#jz8__1S@U)2j?DCj>Dc;g*O}dn7&)ctyi}Ubs2gR2Gv!==^KfwV5^; zjd%GqNdSMKs29(r@BZz4LX>5WDb-(-tRu$M1{3J4h-g-c|@mJ&;m**OPG z8KiG{fQNOQ<#jrc!UyNzRycRw)xy%;jF<`a;o-1g-A7CsGVvU6^b{3;0Hh`#KV@|% zDIUts5ZkJl&`wQEXmNTH{mkH~pj$Uw8yX4U7ziR#VF7A?2XjFp4i)tsJ+gX{ zH|=#wo?4Jv7FW8`7rtm8mJXT7O*>LZcb%?Bu82jS%7xEx$!$+Xf(V4RV=)hxfFL#S z+;NBP`*{6`&Fh+rdQ!=8j~%n!ju!WFLH&4hjg!T6)|Dr303Jz|$-%%q(>BOJ+h=cG z4i>gcIp;e)1)lumpR-bfyos?I9(K`zrklkz`{Z`UQ`x?ZNXF-%)< zJAzo~(8EtIs$Rpi1knXItX=8?OtklKyBV|&FRzOs0Lfp~tf1SIVH12Zy|8I-Co{V0 zq_vq4PYP+RbUFM~QyLa|ELX|DVgueW*#g$ceWv|<#j|5$ma7la2 zM9f8V*xl`4VBUH0QI;QR-F2OdEx5bUQjp9q8?3^(JtGG-Zf2z&tQ~2)Ri@=r_O2f1 zaQw$apcqLPnq0A6^YcDKG)nc+v39+&9bI7gq!^XwxQY&G%03mUB0*MfCWM!(`!1=W*#@8U_VDhY9G^dR!vG36z9xNcCy8%FZt}{A*o|IUJKZc2#=;XHrQiyQeBd!Aq&W2-4gO zzVVyHl4%-@r5ZVCcc-ksF#>zXu?92CX+CTw|G0w?9PtkF-tvlT%M#3+P_Ik(Ew-zYh-KUK0DYY6&S?cR5~=x6B;DUVGd3MGLC*zypb(qgO;Xtw@~ zubT*kG?uymqy~Xx{tRXX$p}77(G`j{V6Iw${>NntJko#=&C+H9dc%Au{3%A1=!ctD zCZJ(VqmbxsO5WGVrg(?6VQc@^_dedSO|>-|`%Oo~$_TN>HbL=l)P5!3>&g4GiihG{=p`oI6^ypiI2N(98 zaHuN4+=8R$?P(m7)H8W_QWJvKt2|1sId>RP;yxWH_{Z_cH=7=2^R4c=0JlD<+Aty^ z^O^1Gsj$&=d#bxeYQ`K14M#$dGvgtFf{EliF8p8AdgH}nA<29m6qvA-7|L0<395@UOYHlin*=@Cj$O278lGd zWt!r46^*Ie-)O1}uAC)*lKBAAk~O?XSMp_uHvRrygb$slR|MkaVXCK551R(&2OmIH z=&D<}Yl|tH(B*st3rf3BpB`U&yn;1ILi9f7*^44(MXH;kL!D_ub@N;0*{{f}yozDB)f z?BCX2M!lBDq<&*BAJxA4pHr{yxGvSfFFJ49fp|p)iV#iMvNQ3tMch=)#?P`iLwrhR zEosp&bJ~_!z|4d_@WgnVb^rq1kFRSL`_9m1Auyj=dd^Kjo02~bOTiNsPJj=B%(W?q z#m<&2kb?nTm$m>R=blk@zXC?^OU@8%bC3Cb1}3P}e(M3V>Vy^_IH7z3x+Yi7>c~DJ zy@zNmTmZ@sVe9Ihd?f8WSo%h+yED`E_i9;3I*wO0`#iC0%vM-q| zM>Z}WEM7qUM^tC0zjEowdskX48WKaWXbsw&)d2-&S*QGmS}LUFnH-5spENVnI6eU{ z%x*fSwy&7|`|YBwMa=govs0avtbHAyW=|VEcTDFcW;i>@1LTOnRqH==!hu2j{SXPq z^Jb89ES~b1v4QMYgr|JwHaFq4`4Q<2N(4vI@B#{e&{Oi=sFU?NN@pr}Pw?8rOD1`f zihCDQ+!XJ#Nk5AUvpS~=_Kp-Uu_=1c($d@Fswth;e=)#+cmJ<@f&Z4=|4QqFZNV3e ap7-Cb(sT2Kf*3CEs2S;*=~nAF$NnFi>o1W2 delta 5267 zcmcgwXH-*7w>}|)2!tkr1eNNGAOg|_B}fqwP(TFfU5ZFoiogk7L5d=vQbGrj&_gdl zMVj=4(2I%)2BZcsB;50T-> zB=mtrWO4J1VJ*RQ<{6;Fz(M+q9Wdpl?UtJx1Doqo|Dg1 z+ZSfh?ZEGdp;Eu+%>Q`U9>0a3S)v~3*SoI!|5^6ub6!uYmeL1OB-zYh8UP>!03as- zFay9b0D!E80cZgD5B~oJga1vZ2C&deo@_f?%Xv*M-KCnB-kbEu3W-EA3nyeq@vTcK zoyQ7C?~o_`>5(xL#VQN|ud}D?{V17dxGQMUDY3D!P}Q+k1f4YH?IwG5L`-;U$iYoE z7j|sJ^GVqDk`slsIzn6;o7Y+OJ5#3mITwBmBv&dEP#O0$t1$(0M#)T^_*A`FI`J-< z?-qQ>`eTSz*ea#6s)-B#okAj#j4!_!qWBYtq&!HZa!X+N>~-qF4Br3JJ)5xE^=vz* zF;SrA=`sn2!`XNU%#)W(u~;3r35U=lQaxW4#v9SP@rp1$Uc5FH3lw^QtICR?qT++g z$sCYS0->-dJPHtV@38fLa~FD_tfuy zO$~0_>vW7qKu83jee-V)n9cE6b#wAgTST0y&EK4CW(`lu@3Ido6W$J;%G4t-{Kv>X zqvlnQ6$K$WKv|pB8KXyY1gnkhajO?j;M?0;IMEA}m>f%+dpa%`(&9;!Or+8KUkXMx z_i(6dr(n#}^s>HNmXwZ;4Xx{6|I%Uz$kMWMo-lYmVgcViTSo@XB_ZEK2AjOkC*mW* zTDZ^~pGZSs0FJtLo4fPzkV?VOWre>oAnL_*BE? zLX)O2JJk?G^qgXm)JjXcrgHd5m0_WP#&PcTXbtG_&E)0UGVedqMMQkm@gheL4K`S4 zppW1s>M53{eX_D*u2GM>;>K)e7&BUil98T1T!Rwcw9{@C6Qd`X!HbH{^T$y{0r^y4 zHxyaf9De@%p3X2D4ez-cnp^loJ$pO+iYO!15CQfqv0<6yI0Q9-pVdcn+S59+U1Jdc zOKw&^nF1o7M%_C$ixz_S^zHLfw#y>QUwCtADEo?SFSNA;t{CLJ)Ef)G3uhB8kRw1q zvhz7@z-DmoZQS}?lU6@nM=;!=a3G%pRZPUsss*+WU5y5s$LVT;@e-3mc)Bh!w*c(S zR_lsrep-YktJHZ_}tV2kbB-+!5uH zq*kx9+{DpqCTBTS61=Oy`$Q3}{kRV~&LEy59v;0-FL}8?(#<2FLect%;a54WA>PZR z27{-wD{HuxTInbs%mW}?C0ro^gj5O##tGcNT^;dVx0Vy{@BeM$WqxK%mEAD}&#cr{ zUota8kUG_ycMeUb~%0mjP^7#Ag6Ccg_{K zADK+t!9^4)2=u52v%wDeuAt7fgs({sU>Te9VYjS1o+vJNJ25YKQ!7sm*McW1LR!|X zpG`Hlnc*{-zMjFqCx5T9t3hP-sY|Z_w_OBf8bcT<`t=c!AI!hbp(hzsvi%t-1^=qv zUd~Ff2AZyjSK2m#Y}64z_{VBmKU6=@qv18!d(m9FGhD&`TVI;~PmkOdxQf5305nis z$>(Q4eGgnEGt>WIRA(ZYDW_*ipKs{r&u2>L+NLWRTif<1WDpCKH#bFiu`HCxmq5TT zdpIil%K0)NT-9Il=o_X=5D}1am;gSpg4>+K4}q?CK7}i6Fdz;?DRm3*{R8q!Lhw-p z&253P@y#B_%PsdI98GgWi__l-qYd>QLJ}8}b!L$OSr;DZhK`_V^dV%c1aCIMm?&@w zWjsDyXo;zmabtJfd4i+aA=5-5@c}R}Fi<5J@F~5>1sV6E$hRYdw(|a7T3TprM-f<5 zl$)DdTpY{!vBtB~wkFu>u0G>fQCpT&ozQ;rq-gXtf!+BWA-7;6Sh9vvP>p_Z4>D}*j_$+_UyH*R~tDJ z{+%vex^zMq5^9MZ@9vJ{^rKS1N35)@=H}+>I!A}wLlg?7GwQh2{rhiXB`;pAt*axr zDI~W$>gX_jl4WOSpW*nqyi6jIPHLJ;-m|yQ#o=~Onw#qB>D|41a&J_s-?lx}qGZgM zgJolHFYw8epVPrLQ3XyjUz<$Rb?FDon85JYn4z5YP+h_v?cm@56GpKBG3sH^0q61X zp^Q!Q&hN?&b^#>==?vEg4~mP5nwp!(NhATbSb5h$0*SQuXMTRC*4^FxgBjK@AmEIw zJ+Q~0?vncI)z;S5{q)_Polw)_(a}+fyTw&fYR)~JW8xkA-x3rbj%#ac@BA8xq8d0j zEavMZRM@mAc@Qq7-RfcleRfxgWHLE{PsY;HlCnNKJur~SS@USResy(qVZpv&q|t*| z_VJ^pm6g@lE1z=fCcjUy2re!zYt)R}_wHozXf{FhEY4S1S%=+%V2^W69ETt;FYh^2 zc<8U;JP+Jo%tgsdm)2&Q{GGnM5RP_+l8eiGQ^_`4J6qfE{S9!DPNPmwO^r@n_+%Tt z)Bs|B{}3`v1QBPIBKx*3l)i9Os0ppbaGKcJRT^E;)Y2k)D1MS{YHDf;{Nv^2WhR*x z(l*!E=kYQ6gkMu@Uf$xDM1ck`8tu%x`Ecsm&w8*SC6jusv36c=rP_>Np2P>T_yOr1tKDv|SS9p6slwva&LyfPi_WZ8n&m z{$!v^_rSX6AaTW4wx(dyCZyxma@Gy}~UzYd2^xNb*V3{sHjLnLSh?S9y`5 zTfO3KPxqeq`i{6M9A`hXvAMZ8xMgK&X`p65Cf$U^CQ<`~gRcZOchyLJlFgd8E|q)h zx%sW@qFMQ~q@?gQ97uvV+7M0)8B@&1V%K_8#UUOp`2`yrzcl#g`_GA)nby#QEoje+ zjf=}c3rL#NOQu^Q1wqger@oQE(Oi_8MQHPX2 z{!mcGtaIVJyG!gk!fzFsyf;<getL=lgdj2M1$wb3SfvImge;fq{YM=A;Pt@u|s43o9%C8)ZZf z5Nk#)bu}|HQ&(4qh#H;J+S&@~iI0!p+VTUzqsB&+b(4v?xw-!S{@z~q1$@M{kexTm z-Z>`k>+0&*n3)%(t)e0$A)_8Y#@SYSKY9eQVQspha;1y}4Vj(IrWzHD>>nKXD*pZZ zS4l}JJuQt$ApF|>yRqTph1dXBMJ9UR58-p|&(V0F4O0bK4w0sxH;lMF;<$H@FlV-% z&%&yw?({44!K8vvFTEeKJR1scF6L?mS;cZ2t^*NMcW7*Hx9pCcFwW1X5DH8Wly5Xj&@{ z6EHO3I|7iGOK64DUdc&J_9%`u@!113n*u;Rcz{~@sVkNTn;5!C)!Rdfar{f>#GS8O zZwLz+Oa-us`Nw7(*U-jJU!XomZ)gQyUZmavtl?3STEhSt+NW9AFK5smu%bET{_bu< zW^k~u^V7h;LGpt!m%l$u4i5_*&dnG`JFjsdcU}drDfhWX8@?pkPC?O#q>tD|8hAE5F z42c+7M#QsG`sT^v4WA@7jtuw1XbIZ!W4W-AiFr^1K&>siL!*bEJGf~mP~vX0eP1)+ zpOd!u^|>mXwxU?&pjfv~e@v`IRjw^RhB}@|{dh=4`k!Y|3 zcJiN?&CqtXp$zYDKa@)qHHI~glf?;SjLHFme&_Atk;v_=!&r4&f z+m9+{*g!VdaLsM@gpJKzEfC&{o9`ywxldu00yKMGD~q&+g+j)gZBZ(VTsj((|3DC9 z1JmiwOTPDmc-olmODLz*_+G-gMu$-MV`Fqr_@0;5wEk7KQQB@h2i?;sd%Ih_r8G?h znv?t7?8c!zPOTQ2-2y# zeVXg5u!v-=Exi1`z(iK-xSO;4q#)NR(In!>XHG~irNwIqWyi1wmBQPj<%TbU>^ zue73E;FqX2*48?n9dF=5(b^q~W0R9HgS#45nMTNoS2cNU*u*}g!9nQ}?*Xy=SgyUD z;_kux3CJX|In05WaUB>!mJ)e#dSu8agj}v3mL-wRirZ?6z)I*ndW1ENT^;KNEm$b} zB9OxkW;{ofHAwU~jg#6)S?;&45TGkAZixtO3Kp$=u($Lxv5p)V;P)zt#?1n)t(p@% zmdVn}s(tDe^j9B-JKu!E#iY}!<$rQYbl&u+hYBhxswVtpMMZBp5TQ^zROmBePf9YW zwey2Ah3*~N z(Dc8)Q5+haYfp`OL#q^pR)%;Gczt4WdgzT}^378>YUD9jsB41?_|y)>x-c*tiY-jF8n;g&C@gb;gP>$Zgq78jd{WM+j2W~hw0d6(uAuL zggwVlrInN!_5~4c3LkMtZ=no1kqqQa;aeGxJT-g*wSpYs$i#ob=NLR4k8O~d%CT5O zLD1vc)#xDQ=x$_HeSIvAIk(_zF!fpm3>z2c^9SzYfuEWR8Jzy(P^-?xkEMQ2NQVBj zpgqu$7kV_yVu1ah-^*P7_pfgMLpS=@K?e+|Xm!omy|17LKuJ&MwswW4edK=uPX7gk From b7abf5f90ab4c87e687df12f4e920f5655657cd1 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 17 Feb 2019 03:46:48 -0300 Subject: [PATCH 03/32] fix(gbot): gbot.cmd now installs packages and compiles the server before running. --- gbot.cmd | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gbot.cmd b/gbot.cmd index 59fb891b..243b11c5 100644 --- a/gbot.cmd +++ b/gbot.cmd @@ -1,2 +1,15 @@ -@echo off +@ECHO off + +ECHO General Bots Command Line + +IF EXIST node_modules goto COMPILE +ECHO Installing Packages for the first time use... +CALL npm install --silent + +:COMPILE +IF EXIST dist goto ALLSET +ECHO Compiling... +CALL tsc + +:ALLSET node dist/src/app.js From c92e007bfd6116fa93e5f07e3d4793657086645b Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 19 Feb 2019 15:25:35 -0300 Subject: [PATCH 04/32] Update README.md --- README.md | 273 ++++-------------------------------------------------- 1 file changed, 20 insertions(+), 253 deletions(-) diff --git a/README.md b/README.md index 52dfdfe0..6d67dd5f 100644 --- a/README.md +++ b/README.md @@ -6,266 +6,19 @@ | Building & Quality | [![Build Status](https://travis-ci.com/pragmatismo-io/BotServer.svg?branch=master)](https://travis-ci.com/pragmatismo-io/BotServer) [![Coverage Status](https://coveralls.io/repos/github/pragmatismo-io/BotServer/badge.svg)](https://coveralls.io/github/pragmatismo-io/BotServer) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | | Packaging | [![forthebadge](https://badge.fury.io/js/botserver.svg)](https://badge.fury.io) [![Dependencies](https://david-dm.org/pragmatismo-io/botserver.svg)](https://david-dm.org) [![Greenkeeper badge](https://badges.greenkeeper.io/pragmatismo-io/BotServer.svg)](https://greenkeeper.io/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | | Releases | [![General Bots](https://img.shields.io/npm/dt/botserver.svg?logo=npm&label=botserver)](https://www.npmjs.com/package/botserver/) [![.gbapp lib](https://img.shields.io/npm/dt/botlib.svg?logo=npm&label=botlib)](https://www.npmjs.com/package/botlib/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)| +| Samples | [default.gbdialog (VBA)](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbdialog) | [AzureADPasswordReset.gbapp (TypeScript)](https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp)| | [Docker Image](https://github.com/lpicanco/docker-botserver) | ![Docker Automated build](https://img.shields.io/docker/automated/lpicanco/botserver.svg) ![Docker Build Status](https://img.shields.io/docker/build/lpicanco/botserver.svg) ![MicroBadger Size](https://img.shields.io/microbadger/image-size/lpicanco/botserver.svg) ![MicroBadger Layers](https://img.shields.io/microbadger/layers/lpicanco/botserver.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/lpicanco/botserver.svg)
*Provided by [@lpicanco](https://github.com/lpicanco/docker-botserver)* | - -#### Watch a video about easeness authoring of bot packages, development environment and self-deployment - -* Now with the General Bots server you can press F5 on Visual Studio to get a bot factory on your environment* published on November 10th, 2018. - -[![General Bot Video](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-01-thumb.jpg)](https://www.youtube.com/watch?v=AfKTwljoMOs) - - -Welcome to General Bot Community Edition ----------------------------------------- +General Bots +------------------ ![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/logo.png) General Bot is a strongly typed package based chat bot server focused in convention over configuration and code-less approaches, which brings software packages and application server concepts to help parallel bot development. +## Guide -## Sample Package #1: [default.gbdialog (VBA)](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbdialog) - - -* See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018. - -[![See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-02-thumb.jpg)](https://www.youtube.com/watch?v=yX1sF9n9628) - - -## Sample Package #2: [AzureADPasswordReset.gbapp (TypeScript)](https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp) - - -Custom dialogs for reseting user password in Azure Active Directory, Office 365, Dynamics 365 or any app published through Azure AD. See also [IntranetBotQuickStart.gbai](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai) and related MSDN article **[Applied AI – Using a Bot for Password Reset](https://blogs.msdn.microsoft.com/buckwoody/2018/09/25/applied-ai-using-a-bot-for-password-reset)** by *Rodrigo Souza*. - - -### Bot Administrator - Setup Security - -So the Bot provides an **admin** mode allowing the user having the Directory.AccessAsUser.All permission to be logged on Administrative interface to obtain and save its token into the database. - -![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/AzureADPasswordReset.gbapp/master/docs/general-bots-reset-ad-password-admin.gif) - -### Bot User - Reset Password - - -With the access token stored in the database, any user can access anonymously the -bot and through a combination of e-mail and mobile received code, the user will be able to reset her or his password. - -#### Reset password via Web - -Any user can use a web address to talk to a reset password bot. Just provide credentials that are confronted with Microsoft Graph to ensure security. - -![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/AzureADPasswordReset.gbapp/master/docs/password.gif) - -general-bots-reset-ad-password.gif - -#### Reset password via Skype - -This is the case when user does not have the password to login on Skype for Business or Teams, and they need to reset their password, so the right tool is Skype. - -![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/AzureADPasswordReset.gbapp/master/docs/general-bots-reset-ad-password.gif) - - -## What is a Bot Server? - -![General Bots Starting From Scrach](https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-open-core-starting-from-scratch.gif) - -Bot Server accelerates the process of developing a bot. It provisions all code -base, resources and deployment to the cloud, and gives you templates you can -choose from whenever you need a new bot. The server has a database and service -backend allowing you to further modify your bot package directly by downloading -a zip file, editing and uploading it back to the server (deploying process) with -no code. The Bot Server also provides a framework to develop bot packages in a more -advanced fashion writing custom code in editors like Visual Studio Code, Atom or Brackets. - -Everyone can create bots by just copying and pasting some files and using their -favorite tools like Excel (or any text editor) or Photoshop (or any image -editor). - -Package Quick Reference ------------- -|Whatsapp|Web|Core|KB| -|----|-----|----|----| -|[whatsapp.gblib](https://github.com/pragmatismo-io/BotServer/tree/master/packages/whatsapp.gblib)|[default.gbui](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbui)|[core.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/core.gbapp)|[kb.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/kb.gbapp)| - -### The bot development stack - -![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png) - -### The Bot Factory - -![General Bots Block Architecture](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-block-architecture.png) - -GeneralBots aims to delivery bots in azure in a very easy and fast fashion. Use Office tools like Word or Excel to edit your Bot - using code (JavaScript or TypeScript) just to empower custom requirements. - - -#### Use Excel for (Hierarchical) Knowledge Base Editing - -![General Bots Inside Excel can enable bot production the masses](https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/general-bots-composing-subjects-json-and-excel.gif) - -#### Use Visual Studio for a complete .gbai package building system - -![General Bots Inside Visual Studio Code provides a complete artificial intelligence based conversational platform](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-inside-visual-studio-code-provides-a-complete-artificial-intelligence-based-conversational-platform.png) - - -How To ------- - -### Run the server locally - -1. Install [Node.js](https://www.npmjs.com/get-npm) the current generation General Bot code execution platform; -2. Open a **Terminal** on Linux and Mac or a **Command Prompt** window on Windows; -3. Type `npm install -g botserver` and press *ENTER*; -4. Type `gbot` to run the server core. - -Notes: - -* [*nodejs.install* Chocolatey Package](https://chocolatey.org/packages/nodejs.install) is also available. -* The zip source code of General Bot is also available for [Download](https://codeload.github.com/pragmatismo-io/BotServer/zip/master); - -### Configure the server to deploy specific directory - -1. Create/Edit the .env file and add the ADDITIONAL_DEPLOY_PATH key pointing to the .gbai local parent folder of .gbapp, .gbot, .gbtheme, .gbkb package directories. -2. Specify STORAGE_SYNC to TRUE so database sync is run when the server is run. -3. In case of Microsoft SQL Server add the following keys: STORAGE_SERVER, STORAGE_NAME, STORAGE_USERNAME, STORAGE_PASSWORD, STORAGE_DIALECT to `mssql`. - -Note: - -* You can specify several bots separated by semicolon, the BotServer will serve all of them at once. - -## Setup development environment (Windows) - -1. [Optional] Install [Chocolatey](https://chocolatey.org/install), a Windows Package Manager; -2. Install [git](`https://git-scm.com/`), a Software Configuration Management (SCM).; -3. Install [Node.js](npmjs.com/get-npm), a [Runtime system](https://en.wikipedia.org/wiki/Runtime_system). -(https://www.npmjs.com/get-npm) (suggested: LTS 8.x.x); -4. Install [Visual Studio Code](https://chocolatey.org/packages/nodejs.install), Brackets or Atom as an editor of your choice; -5. [Fork](https://en.wikipedia.org/wiki/Fork_(software_development)) by visiting https://github.com/pragmatismo-io/BotServer/fork -6. Clone the just forked repository by running `git clone /BotServer.git` ; -7. Run `npm install -g typescript`; -8. Run `npm install` on Command Prompt or PowerShell on the General Bot source-code folder; -9. Enter './packages/default.gbui' folder; -10. Run `npm install` folled by `npm run build` (To build default Bot UI); -11. Enter the On the downloaded folder (../..); -12. Compile the bot server by `tsc`. -13. Run the bot server by `npm start`. - -Note: - -* Whenever you are ready to turn your open-source bot ideas in form of .gbapp (source-code) and artifacts like .gbkb, .gbtheme, .gbot or the .gbai full package read [CONTRIBUTING.md](https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md) about performing Pull Requests (PR) and creating other public custom packages repositories of your own personal or organization General Bot Community Edition powered packages. - -### Running unit tests - -1. Enter the BotServer root folder. -2. Run tests by `npm test`. - -### Just copy the source code to your machine - -1. [Download] the Zip file of (https://codeload.github.com/pragmatismo-io/BotServer/zip/master) - -### Updating the Bot Knoledge Base (.gbkb folder) - -The subjects.json file contains all information related to the subject tree and can be used to build the menu carrousel as well give a set of words to be used as subject catcher in the conversation. A hierarchy can be specified. - -### Creating a new Theme folder (.gbtheme folder) - -A theme is composed of some CSS files and images. That set of files can change -everything in the General Bot UI. Use them extensively before going to change -the UI application itself (HTML & JS). - -Package Types -------------- - -### .gbai - -Embraces all packages types (content, logic & conversation) into a pluggable bot -directory. [A sample .gbai is available](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai). - -### .gbapp - -The artificial intelligence extensions in form of pluggable apps. Dialogs, -Services and all model related to data. A set of interactions, use cases, -integrations in form of conversationals dialogs. -The .gbapp adds the General Bot base library (botlib) for building Node.js TypeScript Apps packages. - - -Four components builds up a General Bot App: - -* dialogs -* models -* services -* tests - -#### Dialogs - -All code contained in a dialog builds the flow to custom conversations in -built-in and additional packages . - - -#### Models - -Models builds the foundation of data relationships in form of entities. - - -#### Services - -Services are a façade for bot back-end logic and other custom processing. - -#### Tests - -Tests try to automate code execution validation before crashing in production. - - -### .gbot - -An expression of an artificial inteligence entity. A .gbot file defines -all bots dependencies related to services and other resources. - -### .gbtheme - -A theme of a bot at a given time. CSS files & images that can compose all UI -presentation and using it a branding can be done. [A sample .gbtheme is available](https://github.com/pragmatismo-io/Office365.gbtheme) - -### .gbkb - -A set of subjects that bot knows in a form of hierarchical menu-based QnA. [A sample .gbkb is available](https://github.com/pragmatismo-io/ProjectOnline.gbkb). - -### .gblib - -Shared code that can be used across bot apps. - -Reference ---------- - -### GeneralBots admin commands - -General Bot can be controlled by the same chat window people talk to, so -here is a list of admin commands related to deploying .gb* files. - -| Command | Description | -|-----------------|-----------------------------------------------------------------------------------------------------------------| -| deployPackage | Deploy a KB package. Usage **deployPackage** [package-name]. Then, you need to run rebuildIndex. | -| undeployPackage | Undeploy a KB. Usage **undeployPackage** [package-name]. | -| redeployPackage | Undeploy and then deploys the KB. Usage **redeployPackage** [package-name]. Then, you need to run rebuildIndex. | -| setupSecurity | Setup connection to user directories. | - -Discontinued commands: - -| Command | Description |Reason | -|-----------------| -----------------------------------------------------------------------------------------------------------------|------| -| rebuildIndex | Rebuild Azure Search indexes, must be run after **deployPackage** or **redeployPackage**. | Now it is called automatically | - -### Credits & Inspiration - -* Rodrigo Rodriguez (me@rodrigorodriguez.com) - Coding, Docs & Architecture. -* David Lerner (david.lerner@hotmail.com) - UI, UX & Theming. -* Eduardo Romeiro (eromeirosp@outlook.com) - Content & UX. -* Jorge Ramos (jramos@pobox.com) - Coding, Docs & Architecture. -* PH Nascimento (ph.an@outlook.com) - Product Manager - -Powered by Microsoft [BOT Framework](https://dev.botframework.com/) and [Azure](http://www.azure.com). - -General Bot Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brasil, state of Piaui. -[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine". +[Read the General Bots Guide](/generalbots/botbook). ## Contributing @@ -303,5 +56,19 @@ trademark license. Therefore any rights, title and interest in our trademarks remain entirely with us. -:speech_balloon: Ask a question          :book: Read the Docs +:speech_balloon: Ask a question          :book: Read the Docs + +# Videos + +## Easeness authoring of bot packages, development environment and self-deployment. + +* Now with the General Bots server you can press F5 on Visual Studio to get a bot factory on your environment* published on November 10th, 2018. + +[![General Bot Video](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-01-thumb.jpg)](https://www.youtube.com/watch?v=AfKTwljoMOs) + +## Using TALK and HEAR to build Virtual Assistants with BASIC + +* See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018. + +[![See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-02-thumb.jpg)](https://www.youtube.com/watch?v=yX1sF9n9628) From 2a4a886ab19b755451e2278d5aa75bf3f56f5b29 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 19 Feb 2019 15:28:41 -0300 Subject: [PATCH 05/32] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d67dd5f..13ea07e7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ General Bot is a strongly typed package based chat bot server focused in convent ## Guide -[Read the General Bots Guide](/generalbots/botbook). +[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/01%20-%20Overview.md). ## Contributing @@ -56,7 +56,7 @@ trademark license. Therefore any rights, title and interest in our trademarks remain entirely with us. -:speech_balloon: Ask a question          :book: Read the Docs +:speech_balloon: Ask a question          :book: Read the Docs # Videos From 752b7b1eac2fa84e901b202e7f37d7d2dc448509 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 19 Feb 2019 15:29:19 -0300 Subject: [PATCH 06/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13ea07e7..ddf082da 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ | Building & Quality | [![Build Status](https://travis-ci.com/pragmatismo-io/BotServer.svg?branch=master)](https://travis-ci.com/pragmatismo-io/BotServer) [![Coverage Status](https://coveralls.io/repos/github/pragmatismo-io/BotServer/badge.svg)](https://coveralls.io/github/pragmatismo-io/BotServer) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | | Packaging | [![forthebadge](https://badge.fury.io/js/botserver.svg)](https://badge.fury.io) [![Dependencies](https://david-dm.org/pragmatismo-io/botserver.svg)](https://david-dm.org) [![Greenkeeper badge](https://badges.greenkeeper.io/pragmatismo-io/BotServer.svg)](https://greenkeeper.io/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | | Releases | [![General Bots](https://img.shields.io/npm/dt/botserver.svg?logo=npm&label=botserver)](https://www.npmjs.com/package/botserver/) [![.gbapp lib](https://img.shields.io/npm/dt/botlib.svg?logo=npm&label=botlib)](https://www.npmjs.com/package/botlib/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)| -| Samples | [default.gbdialog (VBA)](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbdialog) | [AzureADPasswordReset.gbapp (TypeScript)](https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp)| +| Samples | [default.gbdialog (VBA)](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbdialog) [AzureADPasswordReset.gbapp (TypeScript)](https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp)| | [Docker Image](https://github.com/lpicanco/docker-botserver) | ![Docker Automated build](https://img.shields.io/docker/automated/lpicanco/botserver.svg) ![Docker Build Status](https://img.shields.io/docker/build/lpicanco/botserver.svg) ![MicroBadger Size](https://img.shields.io/microbadger/image-size/lpicanco/botserver.svg) ![MicroBadger Layers](https://img.shields.io/microbadger/layers/lpicanco/botserver.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/lpicanco/botserver.svg)
*Provided by [@lpicanco](https://github.com/lpicanco/docker-botserver)* | General Bots From dca0325ad8830dcf072f436e35c89418ceeb03ca Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 19 Feb 2019 15:30:07 -0300 Subject: [PATCH 07/32] fix(gbot): gbot.cmd now installs packages and compiles the server before running. --- package-lock.json | 52 ++++++++++++++----- packages/core.gbapp/services/GBAPIService.ts | 40 +++++++++++--- packages/core.gbapp/services/GBVMService.ts | 2 +- packages/default.gbdialog/bot.vbs | 2 - .../sys-bot-farm-creation.vbs | 36 +++++++++++++ 5 files changed, 107 insertions(+), 25 deletions(-) create mode 100644 packages/default.gbdialog/sys-bot-farm-creation.vbs diff --git a/package-lock.json b/package-lock.json index 3b908be7..65763b45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6964,7 +6964,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6982,11 +6983,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6999,15 +7002,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -7110,7 +7116,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -7120,6 +7127,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7132,17 +7140,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -7159,6 +7170,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7231,7 +7243,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7241,6 +7254,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7316,7 +7330,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7346,6 +7361,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", @@ -7363,6 +7379,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7401,11 +7418,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -13608,6 +13627,7 @@ "align-text": { "version": "0.1.4", "bundled": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -13887,7 +13907,8 @@ }, "is-buffer": { "version": "1.1.6", - "bundled": true + "bundled": true, + "optional": true }, "is-builtin-module": { "version": "1.0.0", @@ -13959,6 +13980,7 @@ "kind-of": { "version": "3.2.2", "bundled": true, + "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -13999,7 +14021,8 @@ }, "longest": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "lru-cache": { "version": "4.1.3", @@ -14228,7 +14251,8 @@ }, "repeat-string": { "version": "1.6.1", - "bundled": true + "bundled": true, + "optional": true }, "require-directory": { "version": "2.1.1", diff --git a/packages/core.gbapp/services/GBAPIService.ts b/packages/core.gbapp/services/GBAPIService.ts index 118724e8..85f3ad5a 100644 --- a/packages/core.gbapp/services/GBAPIService.ts +++ b/packages/core.gbapp/services/GBAPIService.ts @@ -37,21 +37,45 @@ import { WaterfallStepContext } from 'botbuilder-dialogs'; import { GBMinInstance } from 'botlib'; const WaitUntil = require('wait-until'); -/** - * @fileoverview General Bots server core. - */ - -export class DialogClass { +class SysClass { public min: GBMinInstance; - public context: TurnContext; - public step: WaterfallStepContext; constructor(min: GBMinInstance) { this.min = min; } + public async deployBot( + botId, + description, + location, + nlpAuthoringKey, + appId, + appPassword, + subscriptionId + ) { + + } +} +/** + * @fileoverview General Bots server core. + */ + +export default class DialogClass { + public min: GBMinInstance; + public context: TurnContext; + public step: WaterfallStepContext; + public internalSys: SysClass; + + constructor(min: GBMinInstance) { + this.min = min; + } + + public async sys() { + return this.internalSys; + } + public async hear(cb) { - let idCallback = Math.floor(Math.random() * 1000000000000); + const idCallback = Math.floor(Math.random() * 1000000000000); this.min.cbMap[idCallback] = cb; await this.step.beginDialog('/hear', { id: idCallback}); } diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index f7d56861..a016f362 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -35,7 +35,7 @@ import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBCoreService } from 'botlib'; import * as fs from 'fs'; -import { DialogClass } from './GBAPIService'; +import DialogClass from './GBAPIService'; import { GBDeployer } from './GBDeployer'; import { TSCompiler } from './TSCompiler'; const util = require('util'); diff --git a/packages/default.gbdialog/bot.vbs b/packages/default.gbdialog/bot.vbs index d5ddca66..d81ccc15 100644 --- a/packages/default.gbdialog/bot.vbs +++ b/packages/default.gbdialog/bot.vbs @@ -34,8 +34,6 @@ ' '**************************************************************************** - - talk ("How many installments do you want to pay your Credit?") installments = hear () diff --git a/packages/default.gbdialog/sys-bot-farm-creation.vbs b/packages/default.gbdialog/sys-bot-farm-creation.vbs new file mode 100644 index 00000000..c18b3305 --- /dev/null +++ b/packages/default.gbdialog/sys-bot-farm-creation.vbs @@ -0,0 +1,36 @@ +' General Bots Copyright (c) Pragmatismo.io. All rights reserved. +' Licensed under the AGPL-3.0. + +talk "Please, tell me what is the Bot name?" +hear name + +talk "If you tell me your username/password, I can show service subscription list to you." +talk "What is your Username (eg.: human@domain.bot)" +hear email + +talk "Your password? (Will be discarded after sigining process)" +talk "Let's generate a very dificult to guess password for the new bot:" +generate a password +talk "Your password is *" + password + "*. Keep it on a safe place only acessible to you." +talk "Can you describe in a few words what the bot is about?" +hear description + +talk "Please, choose what subscription would you like to connect to:" +hear one of subscriptions (email, password) into subscriptionId + +talk "Please, provide the cloud location just like 'westus'?" +hear cloudLocation + +talk "Please, provide the Authoring Key for NLP service (LUIS)?" +hear nlpKey + +talk "Sorry, this part cannot be automated yet due to Microsoft schedule, please go to https://apps.dev.microsoft.com/portal/register-app to generate manually an App ID and App Secret." +wait 1 +talk "Please, provide the App ID you just generated:" +hear appId + +talk "Please, provide the Generated Password:" +hear appPassword + +talk "Now, I am going to create a Bot farm... Wait 5 minutes or more..." +create bot farm (name, username, password, description, cloudLocation, nlpKey, appId, appPassword, subscriptionId) From 9d0b211b12c718a7a1397a8fda7c9b3595c63a26 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Wed, 20 Feb 2019 08:10:56 -0300 Subject: [PATCH 08/32] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ddf082da..8e63dd6d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ General Bots General Bot is a strongly typed package based chat bot server focused in convention over configuration and code-less approaches, which brings software packages and application server concepts to help parallel bot development. +![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png) + ## Guide [Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/01%20-%20Overview.md). From eaba9d7bf20c6e109be71ecc6da89ade99501403 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Wed, 20 Feb 2019 08:13:31 -0300 Subject: [PATCH 09/32] Update README.md --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e63dd6d..22d0eb5c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,19 @@ General Bots General Bot is a strongly typed package based chat bot server focused in convention over configuration and code-less approaches, which brings software packages and application server concepts to help parallel bot development. -![General Bot Logo](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png) +## What is a Bot Server? + +Bot Server accelerates the process of developing a bot. It provisions all code +base, resources and deployment to the cloud, and gives you templates you can +choose from whenever you need a new bot. The server has a database and service +backend allowing you to further modify your bot package directly by downloading +a zip file, editing and uploading it back to the server (deploying process) with +no code. The Bot Server also provides a framework to develop bot packages in a more +advanced fashion writing custom code in editors like Visual Studio Code, Atom or Brackets. + +Everyone can create bots by just copying and pasting some files and using their +favorite tools from Office (or any text editor) or Photoshop (or any image +editor). BASIC can be used to build custom dialogs so Bot can be extended just like VBA for Excel (currently in alpha). ## Guide From 3481edd422271bdd29302030e2c5b46be0f5b729 Mon Sep 17 00:00:00 2001 From: Garagem <45003963+ExperimentationGarage@users.noreply.github.com> Date: Thu, 21 Feb 2019 16:16:05 -0300 Subject: [PATCH 10/32] chore(gbot): fix the URL --- packages/azuredeployer.gbapp/services/AzureDeployerService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index b271e795..023fdfba 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -485,7 +485,7 @@ export class AzureDeployerService extends GBService { process.stdout.write( `${GBAdminService.GB_PROMPT}Due to this opened issue: https://github.com/Microsoft/botbuilder-tools/issues/550\n` ); - process.stdout.write(`${GBAdminService.GB_PROMPT}Please enter your LUIS Authoring Key:`); + process.stdout.write(`${GBAdminService.GB_PROMPT}Please enter your LUIS Authoring Key:`); // TODO: INCLUDE URL authoringKey = scanf('%s').replace(/(\n|\r)+$/, ''); } }; From 3cc92ecec7786e5a478fa8f8503d8a1d72327f04 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sat, 23 Feb 2019 13:17:21 -0300 Subject: [PATCH 11/32] feat(basic): General Bots BASIC 2.0 with new keywords and parenthesis only when needed. --- package-lock.json | 2516 ++++++++--------- package.json | 44 +- packages/admin.gbapp/dialogs/AdminDialog.ts | 2 +- .../services/ConsoleDirectLine.ts | 1 - packages/core.gbapp/services/GBAPIService.ts | 7 +- packages/core.gbapp/services/GBDeployer.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 293 +- packages/core.gbapp/services/GBVMService.ts | 157 +- packages/default.gbdialog/bot.vbs | 73 +- .../sys-bot-farm-creation.vbs | 12 +- .../security.gblib/services/SecService.ts | 1 - .../services/WhatsappDirectLine.ts | 1 - src/app.ts | 6 +- 13 files changed, 1518 insertions(+), 1597 deletions(-) diff --git a/package-lock.json b/package-lock.json index 65763b45..806acdfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "botserver", - "version": "1.2.0", + "version": "1.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1524,9 +1524,9 @@ "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" }, "@types/async": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@types/async/-/async-2.4.0.tgz", - "integrity": "sha512-1/6EglKPJZjkj2KWSFrvbOeqDZTb+KEiU293MUwc/z3/g4a+jOPADHfcOzt/EbY0uEEr+dkUWTYQfVDzzOrMaw==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/async/-/async-2.4.1.tgz", + "integrity": "sha512-C09BK/wXzbW+/JK9zckhe+FeSbg7NmvVjUWwApnw7ksRpUq3ecGLiq2Aw1LlY4Z/VmtdhSaIs7jO5/MWRYMcOA==" }, "@types/bluebird": { "version": "3.5.18", @@ -1679,9 +1679,9 @@ "integrity": "sha512-cDB930/7MbzaGF6U3IwSQp6XBru8xWajF5PV2YZZeV8DyiliTuld11afVztGI9+yJZ29il5E+NpGA6ooV/Cjkg==" }, "@types/mime": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz", - "integrity": "sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz", + "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==" }, "@types/minimatch": { "version": "3.0.3", @@ -1689,9 +1689,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/mocha": { - "version": "5.2.5", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", - "integrity": "sha1-ikrM/EA8EkoLr+ip/GGgXsEDIHM=" + "version": "5.2.6", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", + "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==" }, "@types/node": { "version": "10.11.7", @@ -1730,10 +1730,15 @@ "@types/request": "*" } }, + "@types/semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==" + }, "@types/sequelize": { - "version": "4.27.34", - "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.34.tgz", - "integrity": "sha512-s2NjoIbZewDn64SrZlHZWqJcotK/Ae9m9nh0jcV/5r3ufcHWguLfEr+165Un9eZtRZszY5vDDNzy4jWc5gptDQ==", + "version": "4.27.37", + "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.37.tgz", + "integrity": "sha512-o1bnbLaw/tPf0QsrLyXB1JwnMvK7gNR29bgCjNlk0fnYyHHk9M7jrnevqjM8tkd5uJVx5bRj09Bxm4ynrYyCkQ==", "dev": true, "requires": { "@types/bluebird": "*", @@ -1761,9 +1766,9 @@ } }, "@types/sprintf-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/sprintf-js/-/sprintf-js-1.1.1.tgz", - "integrity": "sha512-h8jF5yPUoHH1QUIDfHgqFs7Y0UykKB5CJ1Z32PHGmHRLmW0pI+kYKAEnXVqeUZ3ygFmDkyvhD4vUZN+RZyTd1w==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@types/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-hkgzYF+qnIl8uTO8rmUSVSfQ8BIfMXC4yJAF4n8BE758YsKBZvFC4NumnAegj7KmylP0liEZNpb9RRGFMbFejA==" }, "@types/tough-cookie": { "version": "2.3.3", @@ -1857,9 +1862,9 @@ }, "dependencies": { "acorn": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.6.tgz", - "integrity": "sha512-5M3G/A4uBSMIlfJ+h9W125vJvPFH/zirISsW5qfxF5YzEvXJCtolLoQvM5yZft0DvMcUrPGKPOlgEu55I6iUtA==" + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.0.tgz", + "integrity": "sha512-MW/FjM+IvU9CgBzjO3UIPCE2pyEwUsoFl+VGdczOPEdxfGFjuKny/gN54mOuX7Qxmb9Rg9MCn2oKiSUeW+pjrw==" } } }, @@ -2000,6 +2005,11 @@ } } }, + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==" + }, "ansi-escapes": { "version": "3.1.0", "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", @@ -2063,10 +2073,20 @@ "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha1-vLJLTzeTTZqnrBe0ra+J58du8us=", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", "requires": { "micromatch": "^3.1.4", "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } } }, "aproba": { @@ -2219,11 +2239,18 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" }, "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha1-skWiPKcZMAROxT+kaqAKPofGphA=", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", + "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", "requires": { - "lodash": "^4.17.10" + "lodash": "^4.17.11" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + } } }, "async-each": { @@ -2279,7 +2306,7 @@ }, "axios": { "version": "0.18.0", - "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", "requires": { "follow-redirects": "^1.3.0", @@ -2332,11 +2359,28 @@ } }, "azure-cognitiveservices-luis-runtime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/azure-cognitiveservices-luis-runtime/-/azure-cognitiveservices-luis-runtime-1.1.0.tgz", - "integrity": "sha512-0MKylLmqUUxGTl+iKFopQb4ni7OWRkvDujrWX75s4i8T5Kl+IZXaODGYuWwvGlsbqH/D/+Jf1VD3oCBve+AJBw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/azure-cognitiveservices-luis-runtime/-/azure-cognitiveservices-luis-runtime-1.2.2.tgz", + "integrity": "sha512-qds2UQ85IWMj9w3HXB0BS0MqSyQ50YlVtS6Y1X6aSf2sN1RVvdct6gZnUMREgjDTKgo+/Iwh4MmPVmhvpPUu0A==", "requires": { - "ms-rest": "^2.3.3" + "ms-rest": "^2.5.0" + }, + "dependencies": { + "ms-rest": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.5.0.tgz", + "integrity": "sha512-QUTg9CsmWpofDO0MR37z8B28/T9ObpQ+FM23GGDMKXw8KYDJ3cEBdK6dJTDDrtSoZG3U+S/vdmSEwJ7FNj6Kog==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.88.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + } + } } }, "azure-cognitiveservices-textanalytics": { @@ -2377,7 +2421,7 @@ }, "readable-stream": { "version": "2.0.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "requires": { "core-util-is": "~1.0.0", @@ -2390,7 +2434,7 @@ }, "sax": { "version": "0.5.8", - "resolved": "http://registry.npmjs.org/sax/-/sax-0.5.8.tgz", + "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz", "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=" }, "string_decoder": { @@ -2580,9 +2624,9 @@ "dev": true }, "big-integer": { - "version": "1.6.36", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz", - "integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==" + "version": "1.6.42", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.42.tgz", + "integrity": "sha512-3UQFKcRMx+5Z+IK5vYTMYK2jzLRJkt+XqyDdacgWgtMjjuifKpKTFneJLEgeBElOE2/lXZ1LcMcb5s8pwG2U8Q==" }, "big-number": { "version": "1.0.0", @@ -2610,9 +2654,9 @@ } }, "binary-extensions": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", - "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", + "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==" }, "binary-search-bounds": { "version": "2.0.3", @@ -2620,9 +2664,9 @@ "integrity": "sha1-X/hhbW3SylOIvIWy1iZuK52lAtw=" }, "bl": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.1.2.tgz", - "integrity": "sha512-DvC0x+PxmSJNx8wXoFV15pC2+GOJ3ohb4F1REq3X32a2Z3nEBpR1Guu740M7ouYAImFj4BXDNilLNZbygtG9lQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz", + "integrity": "sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==", "requires": { "readable-stream": "^2.3.5", "safe-buffer": "^5.1.1" @@ -2659,107 +2703,37 @@ } }, "botbuilder": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", - "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", + "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", "requires": { "@types/filenamify": "^2.0.1", "@types/node": "^9.3.0", "async-file": "^2.0.2", - "botbuilder-core": "^4.1.7", - "botframework-connector": "^4.1.7", + "botbuilder-core": "^4.2.1", + "botframework-connector": "^4.2.1", "filenamify": "^2.0.0", "rimraf": "^2.6.2" }, "dependencies": { - "@types/jsonwebtoken": { - "version": "7.2.8", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz", - "integrity": "sha512-XENN3YzEB8D6TiUww0O8SRznzy1v+77lH7UmuN54xq/IHIsyWjWOzZuFFTtoiRuaE782uAoRwBe/wwow+vQXZw==", - "requires": { - "@types/node": "*" - } - }, "@types/node": { - "version": "9.6.40", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.40.tgz", - "integrity": "sha512-M3HHoXXndsho/sTbQML2BJr7/uwNhMg8P0D4lb+UsM65JQZx268faiz9hKpY4FpocWqpwlLwa8vevw8hLtKjOw==" - }, - "base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" - }, - "botbuilder-core": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.1.7.tgz", - "integrity": "sha512-kfNOOpHVDLNdpYVMAefWjETXI4VsnDHgucEfKgANcCUrXmsYETlioHOCngUWLrFcaeVMJodeZvafIYl5NTgy0A==", - "requires": { - "assert": "^1.4.1", - "botframework-schema": "^4.1.7" - } - }, - "botframework-connector": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.1.7.tgz", - "integrity": "sha512-aIGY0acc/cMxmg1o+06HqReOjNC8qxbmPJDg+wDgaAwr85bSrDZE1CbyITcj2OqPG/QQ7VM3YzpPAZPlKkDWoQ==", - "requires": { - "@types/jsonwebtoken": "7.2.8", - "@types/node": "^9.3.0", - "@types/request": "^2.47.0", - "base64url": "^3.0.0", - "botframework-schema": "^4.1.7", - "jsonwebtoken": "8.0.1", - "ms-rest-azure-js": "1.0.176", - "ms-rest-js": "1.0.455", - "request": "^2.87.0", - "rsa-pem-from-mod-exp": "^0.8.4" - } - }, - "botframework-schema": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.1.7.tgz", - "integrity": "sha512-vPb5gHldmTIpUFx5uCdv/4XEsouMkXvSfQS2zsAC3VqAo29YESHYzNbr5HecRaUveb48NZ27+Djm0U0mLFxe9Q==", - "requires": { - "@types/node": "^9.3.0", - "ms-rest-js": "1.0.455" - } - }, - "ms-rest-azure-js": { - "version": "1.0.176", - "resolved": "https://registry.npmjs.org/ms-rest-azure-js/-/ms-rest-azure-js-1.0.176.tgz", - "integrity": "sha512-qtEBpSf/1nJ0/m1jGLkHISRnpOeHUp5n4SvzZRdFeYnGF4SQx9v/fl8a8ZwEmyujmgbUwyLNM9qKpH5PmW7pZg==", - "requires": { - "ms-rest-js": "^1.0.443", - "tslib": "^1.9.2" - } - }, - "ms-rest-js": { - "version": "1.0.455", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.455.tgz", - "integrity": "sha512-RUDnFFNhk4ZdvOACg0yfaxmp5OzNwUcTIwgh/rVBeuNzgA7hOoVh5zFW06XmOtaBHXL2Bu/vWoQtzloEUlv9tw==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" } } }, "botbuilder-ai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", - "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.1.tgz", + "integrity": "sha512-gej7KR0iFIK38M4eIkGFOn+Tk7sMpzGTJgMVy/ctz21m6vQDGfqFLjJzDk4GRG9oLaZfq5bqUw5sLtepLAZcUg==", "requires": { "@microsoft/recognizers-text-date-time": "1.1.2", "@types/html-entities": "^1.2.16", "@types/node": "^9.3.0", "@types/request-promise-native": "^1.0.10", "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "^4.2.0", + "botbuilder": "^4.2.1", "html-entities": "^1.2.1", "moment": "^2.20.1", "ms-rest": "^2.3.6", @@ -2768,282 +2742,40 @@ "request-promise-native": "1.0.5" }, "dependencies": { - "@types/jsonwebtoken": { - "version": "7.2.8", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz", - "integrity": "sha512-XENN3YzEB8D6TiUww0O8SRznzy1v+77lH7UmuN54xq/IHIsyWjWOzZuFFTtoiRuaE782uAoRwBe/wwow+vQXZw==", - "requires": { - "@types/node": "*" - } - }, "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" }, - "base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" - }, - "botbuilder": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.0.tgz", - "integrity": "sha512-RqR9j/Dd1ljPFrnYOLt/8g61+5pec+yRFAU0nKSU5S+He+E7t62RzZDsXJuv3KExjDJelUXwTjZFp+vPDIOqQA==", + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", - "async-file": "^2.0.2", - "botbuilder-core": "^4.2.0", - "botframework-connector": "^4.2.0", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" } - }, - "botbuilder-core": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.2.0.tgz", - "integrity": "sha512-aP9C3hymP5DeI88ntg5rG9apaB03FkqhPu/ReEeZmh89WPxWarK5EgXqH0MIS4uomoF24pRY9CXlHscJ37iH1Q==", - "requires": { - "assert": "^1.4.1", - "botframework-schema": "^4.2.0" - } - }, - "botframework-connector": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.2.0.tgz", - "integrity": "sha512-DQtBpB4a6i/lbVBEkYS9IB0WAGJeCY04EiCl1yeh7F9K6uSwE78nNFXJtsWam1PGsinvMwHIHvFyUF5GorUgkA==", - "requires": { - "@types/jsonwebtoken": "7.2.8", - "@types/node": "^9.3.0", - "base64url": "^3.0.0", - "botframework-schema": "^4.2.0", - "form-data": "^2.3.3", - "jsonwebtoken": "8.0.1", - "ms-rest-azure-js": "1.0.176", - "ms-rest-js": "1.0.455", - "nock": "^10.0.3", - "node-fetch": "^2.2.1", - "rsa-pem-from-mod-exp": "^0.8.4" - }, - "dependencies": { - "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==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - } - } - }, - "botframework-schema": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.2.0.tgz", - "integrity": "sha512-IfU27JWFuIADK8q2plUL1v6KuZtv6aR255gZrPrCKRHDPzEz7jGW0ZJoAAkIl9jgMfBPv+Xz6GD5HIHcB+kYGQ==", - "requires": { - "@types/node": "^9.3.0", - "ms-rest-js": "1.0.455" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms-rest-azure-js": { - "version": "1.0.176", - "resolved": "https://registry.npmjs.org/ms-rest-azure-js/-/ms-rest-azure-js-1.0.176.tgz", - "integrity": "sha512-qtEBpSf/1nJ0/m1jGLkHISRnpOeHUp5n4SvzZRdFeYnGF4SQx9v/fl8a8ZwEmyujmgbUwyLNM9qKpH5PmW7pZg==", - "requires": { - "ms-rest-js": "^1.0.443", - "tslib": "^1.9.2" - } - }, - "ms-rest-js": { - "version": "1.0.455", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.455.tgz", - "integrity": "sha512-RUDnFFNhk4ZdvOACg0yfaxmp5OzNwUcTIwgh/rVBeuNzgA7hOoVh5zFW06XmOtaBHXL2Bu/vWoQtzloEUlv9tw==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } - }, - "nock": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.6.tgz", - "integrity": "sha512-b47OWj1qf/LqSQYnmokNWM8D88KvUl2y7jT0567NB3ZBAZFz2bWp2PC81Xn7u8F2/vJxzkzNZybnemeFa7AZ2w==", - "requires": { - "chai": "^4.1.2", - "debug": "^4.1.0", - "deep-equal": "^1.0.0", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.5", - "mkdirp": "^0.5.0", - "propagate": "^1.0.0", - "qs": "^6.5.1", - "semver": "^5.5.0" - } - }, - "node-fetch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", - "integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==" } } }, "botbuilder-azure": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", - "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.1.tgz", + "integrity": "sha512-YbdIF3Xp3m1Ei3EnPY3YyPPrH/u10pBplMTluPnc1Qptd1z5mRtuG02kLsG22SivQN7rhyA8WNSgHlAjXShpeg==", "requires": { "@types/node": "^9.3.0", "azure-storage": "^2.10.2", - "botbuilder": "^4.2.0", + "botbuilder": "^4.2.1", "documentdb": "1.14.5", "flat": "^4.0.0", "semaphore": "^1.1.0" }, "dependencies": { - "@types/jsonwebtoken": { - "version": "7.2.8", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz", - "integrity": "sha512-XENN3YzEB8D6TiUww0O8SRznzy1v+77lH7UmuN54xq/IHIsyWjWOzZuFFTtoiRuaE782uAoRwBe/wwow+vQXZw==", - "requires": { - "@types/node": "*" - } - }, "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" - }, - "base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" - }, - "botbuilder": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.0.tgz", - "integrity": "sha512-RqR9j/Dd1ljPFrnYOLt/8g61+5pec+yRFAU0nKSU5S+He+E7t62RzZDsXJuv3KExjDJelUXwTjZFp+vPDIOqQA==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", - "async-file": "^2.0.2", - "botbuilder-core": "^4.2.0", - "botframework-connector": "^4.2.0", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" - } - }, - "botbuilder-core": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.2.0.tgz", - "integrity": "sha512-aP9C3hymP5DeI88ntg5rG9apaB03FkqhPu/ReEeZmh89WPxWarK5EgXqH0MIS4uomoF24pRY9CXlHscJ37iH1Q==", - "requires": { - "assert": "^1.4.1", - "botframework-schema": "^4.2.0" - } - }, - "botframework-connector": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.2.0.tgz", - "integrity": "sha512-DQtBpB4a6i/lbVBEkYS9IB0WAGJeCY04EiCl1yeh7F9K6uSwE78nNFXJtsWam1PGsinvMwHIHvFyUF5GorUgkA==", - "requires": { - "@types/jsonwebtoken": "7.2.8", - "@types/node": "^9.3.0", - "base64url": "^3.0.0", - "botframework-schema": "^4.2.0", - "form-data": "^2.3.3", - "jsonwebtoken": "8.0.1", - "ms-rest-azure-js": "1.0.176", - "ms-rest-js": "1.0.455", - "nock": "^10.0.3", - "node-fetch": "^2.2.1", - "rsa-pem-from-mod-exp": "^0.8.4" - }, - "dependencies": { - "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==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - } - } - }, - "botframework-schema": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.2.0.tgz", - "integrity": "sha512-IfU27JWFuIADK8q2plUL1v6KuZtv6aR255gZrPrCKRHDPzEz7jGW0ZJoAAkIl9jgMfBPv+Xz6GD5HIHcB+kYGQ==", - "requires": { - "@types/node": "^9.3.0", - "ms-rest-js": "1.0.455" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms-rest-azure-js": { - "version": "1.0.176", - "resolved": "https://registry.npmjs.org/ms-rest-azure-js/-/ms-rest-azure-js-1.0.176.tgz", - "integrity": "sha512-qtEBpSf/1nJ0/m1jGLkHISRnpOeHUp5n4SvzZRdFeYnGF4SQx9v/fl8a8ZwEmyujmgbUwyLNM9qKpH5PmW7pZg==", - "requires": { - "ms-rest-js": "^1.0.443", - "tslib": "^1.9.2" - } - }, - "ms-rest-js": { - "version": "1.0.455", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.455.tgz", - "integrity": "sha512-RUDnFFNhk4ZdvOACg0yfaxmp5OzNwUcTIwgh/rVBeuNzgA7hOoVh5zFW06XmOtaBHXL2Bu/vWoQtzloEUlv9tw==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } - }, - "nock": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.6.tgz", - "integrity": "sha512-b47OWj1qf/LqSQYnmokNWM8D88KvUl2y7jT0567NB3ZBAZFz2bWp2PC81Xn7u8F2/vJxzkzNZybnemeFa7AZ2w==", - "requires": { - "chai": "^4.1.2", - "debug": "^4.1.0", - "deep-equal": "^1.0.0", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.5", - "mkdirp": "^0.5.0", - "propagate": "^1.0.0", - "qs": "^6.5.1", - "semver": "^5.5.0" - } - }, - "node-fetch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", - "integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==" + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" } } }, @@ -3165,12 +2897,12 @@ } }, "botbuilder-core": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.2.0.tgz", - "integrity": "sha512-aP9C3hymP5DeI88ntg5rG9apaB03FkqhPu/ReEeZmh89WPxWarK5EgXqH0MIS4uomoF24pRY9CXlHscJ37iH1Q==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.2.1.tgz", + "integrity": "sha512-U8n+eY9Cjce0GkMyyE0mv4HBjCjtyuczz6usl9XF2N7nY61jYDah4W5e4zqYdLdlqnBwfxG8ptS9pdnmVsC2ww==", "requires": { "assert": "^1.4.1", - "botframework-schema": "^4.2.0" + "botframework-schema": "^4.2.1" } }, "botbuilder-core-extensions": { @@ -3212,16 +2944,16 @@ } }, "botbuilder-dialogs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", - "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.1.tgz", + "integrity": "sha512-QHD9WigzC7rOJT0hb9Xzs/yHs1g/MOabJey8qxlZPdnnQqK5X8KJaZEEDnRqcUmLj/ydbxnxqImLEsMD5zlGag==", "requires": { "@microsoft/recognizers-text-choice": "1.1.2", "@microsoft/recognizers-text-date-time": "1.1.2", "@microsoft/recognizers-text-number": "1.1.2", "@microsoft/recognizers-text-suite": "1.1.2", "@types/node": "^9.3.0", - "botbuilder-core": "^4.2.0" + "botbuilder-core": "^4.2.1" }, "dependencies": { "@microsoft/recognizers-text-choice": { @@ -3259,40 +2991,9 @@ } }, "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" - }, - "botbuilder-core": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.2.0.tgz", - "integrity": "sha512-aP9C3hymP5DeI88ntg5rG9apaB03FkqhPu/ReEeZmh89WPxWarK5EgXqH0MIS4uomoF24pRY9CXlHscJ37iH1Q==", - "requires": { - "assert": "^1.4.1", - "botframework-schema": "^4.2.0" - } - }, - "botframework-schema": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.2.0.tgz", - "integrity": "sha512-IfU27JWFuIADK8q2plUL1v6KuZtv6aR255gZrPrCKRHDPzEz7jGW0ZJoAAkIl9jgMfBPv+Xz6GD5HIHcB+kYGQ==", - "requires": { - "@types/node": "^9.3.0", - "ms-rest-js": "1.0.455" - } - }, - "ms-rest-js": { - "version": "1.0.455", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.455.tgz", - "integrity": "sha512-RUDnFFNhk4ZdvOACg0yfaxmp5OzNwUcTIwgh/rVBeuNzgA7hOoVh5zFW06XmOtaBHXL2Bu/vWoQtzloEUlv9tw==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" } } }, @@ -3315,9 +3016,9 @@ } }, "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" }, "@types/url-join": { "version": "0.8.3", @@ -3358,12 +3059,20 @@ "url-join": "^1.1.0" } }, - "jsonwebtoken": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.4.0.tgz", - "integrity": "sha512-coyXjRTCy0pw5WYBpMvWOMN+Kjaik2MwTUIq9cna/W7NpO9E+iYbumZONAz3hcr+tXFJECoQVrtmIoC3Oz0gvg==", + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", "requires": { - "jws": "^3.1.5", + "safe-buffer": "^5.0.1" + } + }, + "jsonwebtoken": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.0.tgz", + "integrity": "sha512-IqEycp0znWHNA11TpYi77bVgyBO/pGESDh7Ajhas+u0ttkGkKYIIAjniL4Bw5+oVejVF+SYkaI7XKfwCCyeTuA==", + "requires": { + "jws": "^3.2.1", "lodash.includes": "^4.3.0", "lodash.isboolean": "^3.0.3", "lodash.isinteger": "^4.0.4", @@ -3371,9 +3080,34 @@ "lodash.isplainobject": "^4.0.6", "lodash.isstring": "^4.0.1", "lodash.once": "^4.0.0", - "ms": "^2.1.1" + "ms": "^2.1.1", + "semver": "^5.6.0" } }, + "jwa": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.3.0.tgz", + "integrity": "sha512-SxObIyzv9a6MYuZYaSN6DhSm9j3+qkokwvCB0/OTSV5ylPq1wUQiygZQcHT5Qlux0I5kmISx3J86TxKhuefItg==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.1.tgz", + "integrity": "sha512-bGA2omSrFUkd72dhh05bIAN832znP4wOU3lfuXtRBuGTbsmNmDXMQg28f0Vsxaxgk4myF5YkKQpz6qeRpMgX9g==", + "requires": { + "jwa": "^1.2.0", + "safe-buffer": "^5.0.1" + } + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", @@ -3499,14 +3233,14 @@ } }, "botframework-connector": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.2.0.tgz", - "integrity": "sha512-DQtBpB4a6i/lbVBEkYS9IB0WAGJeCY04EiCl1yeh7F9K6uSwE78nNFXJtsWam1PGsinvMwHIHvFyUF5GorUgkA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.2.1.tgz", + "integrity": "sha512-O2RmSG4AFyNc7h9zD2a7kdIBw8jF3Thpl8Pwfs/BpKGhRrCIJAMasV0+UbIV2Iwi2NEl7WzdpXjUsnpmB57XgQ==", "requires": { "@types/jsonwebtoken": "7.2.8", "@types/node": "^9.3.0", "base64url": "^3.0.0", - "botframework-schema": "^4.2.0", + "botframework-schema": "^4.2.1", "form-data": "^2.3.3", "jsonwebtoken": "8.0.1", "ms-rest-azure-js": "1.0.176", @@ -3525,9 +3259,9 @@ } }, "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" }, "base64url": { "version": "3.0.1", @@ -3565,18 +3299,18 @@ } }, "botframework-schema": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.2.0.tgz", - "integrity": "sha512-IfU27JWFuIADK8q2plUL1v6KuZtv6aR255gZrPrCKRHDPzEz7jGW0ZJoAAkIl9jgMfBPv+Xz6GD5HIHcB+kYGQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.2.1.tgz", + "integrity": "sha512-0aJ5UIjs6dKZYdovnlnoIb7+wBId3cubQzwC0tH6S//JhayqrKqMcD8vPPgwZHhBhBx8ZFNmKD3MJtCvZZ1GYA==", "requires": { "@types/node": "^9.3.0", "ms-rest-js": "1.0.455" }, "dependencies": { "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" }, "ms-rest-js": { "version": "1.0.455", @@ -3594,19 +3328,19 @@ } }, "botlib": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.10.tgz", - "integrity": "sha512-1C+YzEZqRQgKpmb88ui0Zae9SubOTu2tZsTnZ1EuR9zH4wfDg5F1vybPrSphzz7zPpItoIdCGcMi553lcyWaxA==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.12.tgz", + "integrity": "sha512-odBPlEBeYHSEfDfiTDknIp+/NM6Ar1q1TShXZ7xwc/+0CD90Y3dyjlVZDwiZtG2vfk5btiB8GjLzgP4v1nYE6A==", "requires": { - "async": "2.6.1", - "botbuilder": "4.1.3", - "botbuilder-ai": "4.2.0", - "botbuilder-azure": "4.2.0", + "async": "2.6.2", + "botbuilder": "4.2.1", + "botbuilder-ai": "4.2.1", + "botbuilder-azure": "4.2.1", "botbuilder-choices": "4.0.0-preview1.2", - "botbuilder-dialogs": "4.2.0", + "botbuilder-dialogs": "4.2.1", "botbuilder-location": "2.0.0", "botbuilder-prompts": "4.0.0-preview1.2", - "chrono-node": "1.3.5", + "chrono-node": "1.3.11", "dotenv-extended": "2.3.0", "iconv-lite": "0.4.24", "ms": "2.1.1", @@ -3618,25 +3352,112 @@ "winston": "3.2.1" }, "dependencies": { + "@microsoft/recognizers-text-choice": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-choice/-/recognizers-text-choice-1.1.2.tgz", + "integrity": "sha512-4hFdqxusM0YrOXYM2RVYPl2rLjItSh6VkRiACjWB95GKC/DBGjJRYQpTxhzuZAsJSkDMinu/aLf8DvQtwUaLtA==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "grapheme-splitter": "^1.0.2" + } + }, + "@microsoft/recognizers-text-number": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.2.tgz", + "integrity": "sha512-GESjSF42dllym83diyd6pmlzFwdzidewoq/qSQz89lSoTx9HdJQHjbXxwdBp7w4Ax/Jroo2lcAedM3B7alZhYQ==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "bignumber.js": "^7.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.sortby": "^4.7.0", + "lodash.trimend": "^4.5.1" + } + }, + "@microsoft/recognizers-text-suite": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-suite/-/recognizers-text-suite-1.1.2.tgz", + "integrity": "sha512-w3WCsKa//64jE1fGPFlV02rRg9+b3oDp+K5/skPAn4KDr80LjXxD1ulIgiJ2Ll/2OoBl8ociCiCjYA7zS3LpdQ==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "@microsoft/recognizers-text-choice": "~1.1.2", + "@microsoft/recognizers-text-date-time": "~1.1.2", + "@microsoft/recognizers-text-number": "~1.1.2", + "@microsoft/recognizers-text-number-with-unit": "~1.1.2", + "@microsoft/recognizers-text-sequence": "~1.1.2" + } + }, "@types/node": { - "version": "9.6.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.41.tgz", - "integrity": "sha512-sPZWEbFMz6qAy9SLY7jh5cgepmsiwqUUHjvEm8lpU6kug2hmmcyuTnwhoGw/GWpI5Npue4EqvsiQQI0eWjW/ZA==" + "version": "9.6.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", + "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + }, + "async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", + "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "requires": { + "lodash": "^4.17.11" + } }, "botbuilder": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.3.tgz", - "integrity": "sha512-o6ASOl3sbgVw3+zKCYFYqLh5UBbifw7EhuIMgPaw/7MMkL8WWT9y0EY63DX7AyDZZZ+sdG0qY6C9/5HvT3e6AA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", + "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", "requires": { "@types/filenamify": "^2.0.1", "@types/node": "^9.3.0", "async-file": "^2.0.2", - "botbuilder-core": "^4.1.3", - "botframework-connector": "^4.1.3", + "botbuilder-core": "^4.2.1", + "botframework-connector": "^4.2.1", "filenamify": "^2.0.0", "rimraf": "^2.6.2" } }, + "botbuilder-ai": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.1.tgz", + "integrity": "sha512-gej7KR0iFIK38M4eIkGFOn+Tk7sMpzGTJgMVy/ctz21m6vQDGfqFLjJzDk4GRG9oLaZfq5bqUw5sLtepLAZcUg==", + "requires": { + "@microsoft/recognizers-text-date-time": "1.1.2", + "@types/html-entities": "^1.2.16", + "@types/node": "^9.3.0", + "@types/request-promise-native": "^1.0.10", + "azure-cognitiveservices-luis-runtime": "^1.0.0", + "botbuilder": "^4.2.1", + "html-entities": "^1.2.1", + "moment": "^2.20.1", + "ms-rest": "^2.3.6", + "mstranslator": "^3.0.0", + "request": "^2.87.0", + "request-promise-native": "1.0.5" + } + }, + "botbuilder-azure": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.1.tgz", + "integrity": "sha512-YbdIF3Xp3m1Ei3EnPY3YyPPrH/u10pBplMTluPnc1Qptd1z5mRtuG02kLsG22SivQN7rhyA8WNSgHlAjXShpeg==", + "requires": { + "@types/node": "^9.3.0", + "azure-storage": "^2.10.2", + "botbuilder": "^4.2.1", + "documentdb": "1.14.5", + "flat": "^4.0.0", + "semaphore": "^1.1.0" + } + }, + "botbuilder-dialogs": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.1.tgz", + "integrity": "sha512-QHD9WigzC7rOJT0hb9Xzs/yHs1g/MOabJey8qxlZPdnnQqK5X8KJaZEEDnRqcUmLj/ydbxnxqImLEsMD5zlGag==", + "requires": { + "@microsoft/recognizers-text-choice": "1.1.2", + "@microsoft/recognizers-text-date-time": "1.1.2", + "@microsoft/recognizers-text-number": "1.1.2", + "@microsoft/recognizers-text-suite": "1.1.2", + "@types/node": "^9.3.0", + "botbuilder-core": "^4.2.1" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3644,6 +3465,21 @@ "requires": { "safer-buffer": ">= 2.1.2 < 3" } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" + } } } }, @@ -3751,7 +3587,7 @@ "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha1-uqVZ7hTO1zRSIputcyZGfGH6vWA=" + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" }, "browserify-mime": { "version": "1.2.9", @@ -4088,23 +3924,22 @@ "integrity": "sha1-sffn/HPSXn/R1FWtyU4UODAYK1o=" }, "chokidar": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", - "integrity": "sha1-NW/04rDo5D4yLRijckYLvPOszSY=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.2.tgz", + "integrity": "sha512-IwXUx0FXc5ibYmPC2XeEj5mpXoV66sR+t3jqu2NS2GYwCktt3KF1/Qqjws/NkegajBA4RbZ5+DDwlOiJsxDHEg==", "requires": { "anymatch": "^2.0.0", - "async-each": "^1.0.0", - "braces": "^2.3.0", - "fsevents": "^1.2.2", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", "glob-parent": "^3.1.0", - "inherits": "^2.0.1", + "inherits": "^2.0.3", "is-binary-path": "^1.0.0", "is-glob": "^4.0.0", - "lodash.debounce": "^4.0.8", - "normalize-path": "^2.1.1", + "normalize-path": "^3.0.0", "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0", - "upath": "^1.0.5" + "readdirp": "^2.2.1", + "upath": "^1.1.0" } }, "chownr": { @@ -4113,11 +3948,18 @@ "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" }, "chrono-node": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/chrono-node/-/chrono-node-1.3.5.tgz", - "integrity": "sha1-oklSmKMtqCvMAa2b59d++l4kQSI=", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/chrono-node/-/chrono-node-1.3.11.tgz", + "integrity": "sha512-jDWRnY6nYvzfV3HPYBqo+tot7tcsUs9i3arGbMdI0TouPSXP2C2y/Ctp27rxKTQDi6yuTxAB2cw+Q6igGhOhdQ==", "requires": { - "moment": "^2.10.3" + "moment": "2.21.0" + }, + "dependencies": { + "moment": { + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.21.0.tgz", + "integrity": "sha512-TCZ36BjURTeFTM/CwRcViQlfkMvL1/vFISuNLO5GkcVm1+QHfbSiNqZuWeMFjj1/3+uAjXswgRk30j1kkLYJBQ==" + } } }, "circular-json": { @@ -4503,26 +4345,29 @@ "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true }, "commitizen": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-3.0.5.tgz", - "integrity": "sha512-WB9sz7qudArOsW1ninU8YGLNoXLQ5lJBZf538iQ7i96SXAkqVMZdmPtSyN4WFPM5PjQR7rWxDa+hzfGIJfrXUg==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-3.0.7.tgz", + "integrity": "sha512-2j8E8Ik1pe1Jqy1gQ1SzEZDJCdr0ItjvhbXmDqhz186Q3ukRoQHMBkmCqmsFYmfDmchBkrOXV1239mTeXEPJKQ==", "dev": true, "requires": { "cachedir": "2.1.0", "cz-conventional-changelog": "2.1.0", "dedent": "0.7.0", "detect-indent": "^5.0.0", - "find-node-modules": "1.0.4", + "find-node-modules": "2.0.0", "find-root": "1.1.0", "fs-extra": "^7.0.0", "glob": "7.1.3", "inquirer": "6.2.0", + "is-utf8": "^0.2.1", "lodash": "4.17.11", "minimist": "1.2.0", "shelljs": "0.7.6", + "strip-bom": "3.0.0", "strip-json-comments": "2.0.1" }, "dependencies": { @@ -4607,14 +4452,14 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, "rxjs": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", - "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz", + "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==", "dev": true, "requires": { "tslib": "^1.9.0" @@ -4622,7 +4467,7 @@ }, "shelljs": { "version": "0.7.6", - "resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.7.6.tgz", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.6.tgz", "integrity": "sha1-N5zM+1a5HIYB5HkzVutTgpJN6a0=", "dev": true, "requires": { @@ -4689,6 +4534,15 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "configstore": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", @@ -4902,9 +4756,9 @@ } }, "coveralls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz", - "integrity": "sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.3.tgz", + "integrity": "sha512-viNfeGlda2zJr8Gj1zqXpDMRjw9uM54p7wzZdvLRyOgnAfCe974Dq4veZkjJdxQXbmdppu6flEajFYseHYaUhg==", "dev": true, "requires": { "growl": "~> 1.10.0", @@ -4912,22 +4766,12 @@ "lcov-parse": "^0.0.10", "log-driver": "^1.2.7", "minimist": "^1.2.0", - "request": "^2.85.0" + "request": "^2.86.0" }, "dependencies": { - "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -4995,22 +4839,22 @@ "dev": true }, "cssom": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", - "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==" + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.6.tgz", + "integrity": "sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A==" }, "cssstyle": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.1.1.tgz", - "integrity": "sha512-364AI1l/M5TYcFH83JnOH/pSqgaNnKmYgKrm0didZMGKWjQB60dymwWy1rKUgL3J1ffdq9xVi2yGLHdSjjSNog==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.2.1.tgz", + "integrity": "sha512-7DYm8qe+gPx/h77QlCyFmX80+fGaE/6A/Ekl0zaszYOubvySO2saYFdQ78P29D0UsULxFKCetDGNaNRUdSF+2A==", "requires": { "cssom": "0.3.x" } }, "csv-parse": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.3.1.tgz", - "integrity": "sha512-1V98UTtfefu8yKdYIGX1LFhfE2yMllveq2uCBay5y4ybfTzvW6I4M6r8Yc2YnKJdJBUig5ksEMh/bLqKg4vEMQ==" + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.3.3.tgz", + "integrity": "sha512-bZ+AZjm2LlWEp5+TKeFeXDldduCUUaxEif+KUv+zvAwmCvCKTqeSHVEyxztGCQ6OE+87ObRq4NsCmg91SuJbhQ==" }, "csv-parser": { "version": "1.12.1", @@ -5206,9 +5050,9 @@ } }, "decompress-zip": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/decompress-zip/-/decompress-zip-0.3.1.tgz", - "integrity": "sha512-pNGzi0RIpLA/CqrMQoSuh/1+YiVGJSEhQeibgoZQEdPFQOhO5pvqim3sp1qMvio3+mkonUQ1Akjdw8RgvV/RsA==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/decompress-zip/-/decompress-zip-0.3.2.tgz", + "integrity": "sha512-Ab1QY4LrWMrUuo53lLnmGOby7v8ryqxJ+bKibKSiPisx+25mhut1dScVBXAYx14i/PqSrFZvR2FRRazhLbvL+g==", "requires": { "binary": "^0.3.0", "graceful-fs": "^4.1.3", @@ -5234,7 +5078,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -5303,7 +5147,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -5543,13 +5386,9 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, "detect-file": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-0.1.0.tgz", - "integrity": "sha1-STXe39lIhkjgBrASlWbpOGcR6mM=", - "dev": true, - "requires": { - "fs-exists-sync": "^0.1.0" - } + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=" }, "detect-indent": { "version": "5.0.0", @@ -5753,6 +5592,31 @@ "safe-buffer": "^5.0.1" } }, + "editorconfig": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.2.tgz", + "integrity": "sha512-GWjSI19PVJAM9IZRGOS+YKI8LN+/sjkSjNyvxL5ucqP9/IqtYNXBaQ/6c/hkPNYQHyOHra2KoXZI/JVpuqwmcQ==", + "requires": { + "@types/node": "^10.11.7", + "@types/semver": "^5.5.0", + "commander": "^2.19.0", + "lru-cache": "^4.1.3", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + } + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -5884,7 +5748,6 @@ "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, "requires": { "es-to-primitive": "^1.1.1", "function-bind": "^1.1.1", @@ -5897,7 +5760,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -5944,9 +5806,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", - "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.1.tgz", + "integrity": "sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw==", "requires": { "esprima": "^3.1.3", "estraverse": "^4.2.0", @@ -6110,8 +5972,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", - "dev": true + "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=" }, "esquery": { "version": "1.0.1", @@ -6226,64 +6087,12 @@ } } }, - "expand-range": { - "version": "1.8.2", - "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "^2.1.0" - }, - "dependencies": { - "fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", - "dev": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, "expand-tilde": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-1.2.2.tgz", - "integrity": "sha1-C4HrqJflo9MdHD0QL48BRB5VlEk=", - "dev": true, + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "requires": { - "os-homedir": "^1.0.1" + "homedir-polyfill": "^1.0.1" } }, "express": { @@ -6514,12 +6323,6 @@ "object-assign": "^4.0.1" } }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, "filename-reserved-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", @@ -6606,13 +6409,27 @@ } }, "find-node-modules": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-1.0.4.tgz", - "integrity": "sha1-tt6zzMtpnIcDdne87eLF9YYrJVA=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.0.0.tgz", + "integrity": "sha512-8MWIBRgJi/WpjjfVXumjPKCtmQ10B+fjx6zmSA+770GMJirLhWIzg8l763rhjl9xaeaHbnxPNRQKq2mgMhr+aw==", "dev": true, "requires": { - "findup-sync": "0.4.2", - "merge": "^1.2.0" + "findup-sync": "^3.0.0", + "merge": "^1.2.1" + }, + "dependencies": { + "findup-sync": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", + "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + } + } } }, "find-parent-dir": { @@ -6684,104 +6501,22 @@ } }, "findup-sync": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.4.2.tgz", - "integrity": "sha1-qBF9D3MST1pFRoOVef5S1xKfteU=", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", + "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", "requires": { - "detect-file": "^0.1.0", - "is-glob": "^2.0.1", - "micromatch": "^2.3.7", - "resolve-dir": "^0.1.0" + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" }, "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "requires": { - "is-extglob": "^1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" + "is-extglob": "^2.1.0" } } } @@ -6820,25 +6555,20 @@ "dev": true }, "follow-redirects": { - "version": "1.5.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.9.tgz", - "integrity": "sha512-Bh65EZI/RU8nx0wbYF9shkFZlqLP+6WT/5FnA3cE/djNSuKNHJEinGGZgu/cQEkeeb2GdFOgenAmn8qaqYke2w==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", + "integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==", "requires": { - "debug": "=3.1.0" + "debug": "^3.2.6" }, "dependencies": { "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -6847,15 +6577,6 @@ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -6910,12 +6631,6 @@ "readable-stream": "^2.0.0" } }, - "fs-exists-sync": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", - "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", - "dev": true - }, "fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", @@ -6934,23 +6649,15 @@ "minipass": "^2.2.1" } }, - "fs-walk": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/fs-walk/-/fs-walk-0.0.2.tgz", - "integrity": "sha1-IhA4W9vDKrUZM87lAu8YUWeXYE0=", - "requires": { - "async": "*" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", + "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", "optional": true, "requires": { "nan": "^2.9.2", @@ -6973,7 +6680,7 @@ "optional": true }, "are-we-there-yet": { - "version": "1.1.4", + "version": "1.1.5", "bundled": true, "optional": true, "requires": { @@ -6996,7 +6703,7 @@ } }, "chownr": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "optional": true }, @@ -7029,7 +6736,7 @@ } }, "deep-extend": { - "version": "0.5.1", + "version": "0.6.0", "bundled": true, "optional": true }, @@ -7072,7 +6779,7 @@ } }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "optional": true, "requires": { @@ -7090,11 +6797,11 @@ "optional": true }, "iconv-lite": { - "version": "0.4.21", + "version": "0.4.24", "bundled": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-walk": { @@ -7151,16 +6858,16 @@ "optional": true }, "minipass": { - "version": "2.2.4", + "version": "2.3.5", "bundled": true, "optional": true, "requires": { - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "minizlib": { - "version": "1.1.0", + "version": "1.2.1", "bundled": true, "optional": true, "requires": { @@ -7181,7 +6888,7 @@ "optional": true }, "needle": { - "version": "2.2.0", + "version": "2.2.4", "bundled": true, "optional": true, "requires": { @@ -7191,17 +6898,17 @@ } }, "node-pre-gyp": { - "version": "0.10.0", + "version": "0.10.3", "bundled": true, "optional": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", - "needle": "^2.2.0", + "needle": "^2.2.1", "nopt": "^4.0.1", "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", - "rc": "^1.1.7", + "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", "tar": "^4" @@ -7217,12 +6924,12 @@ } }, "npm-bundled": { - "version": "1.0.3", + "version": "1.0.5", "bundled": true, "optional": true }, "npm-packlist": { - "version": "1.1.10", + "version": "1.2.0", "bundled": true, "optional": true, "requires": { @@ -7289,11 +6996,11 @@ "optional": true }, "rc": { - "version": "1.2.7", + "version": "1.2.8", "bundled": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -7321,15 +7028,15 @@ } }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { - "version": "5.1.1", + "version": "5.1.2", "bundled": true, "optional": true }, @@ -7344,7 +7051,7 @@ "optional": true }, "semver": { - "version": "5.5.0", + "version": "5.6.0", "bundled": true, "optional": true }, @@ -7390,16 +7097,16 @@ "optional": true }, "tar": { - "version": "4.4.1", + "version": "4.4.8", "bundled": true, "optional": true, "requires": { - "chownr": "^1.0.1", + "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.2" } }, @@ -7409,11 +7116,11 @@ "optional": true }, "wide-align": { - "version": "1.1.2", + "version": "1.1.3", "bundled": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrappy": { @@ -7422,7 +7129,7 @@ "optional": true }, "yallist": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, "optional": true } @@ -7431,8 +7138,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "function.name": { "version": "1.0.11", @@ -7697,42 +7403,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -7768,41 +7438,25 @@ } }, "global-modules": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", - "integrity": "sha1-6lo77ULG1s6ZWk+KEmm12uIjgo0=", - "dev": true, + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "requires": { - "global-prefix": "^0.1.4", - "is-windows": "^0.2.0" - }, - "dependencies": { - "is-windows": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", - "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", - "dev": true - } + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" } }, "global-prefix": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", - "integrity": "sha1-jTvGuNo8qBEqFg2NSW/wRiv+948=", - "dev": true, + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", "requires": { - "homedir-polyfill": "^1.0.0", + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", "ini": "^1.3.4", - "is-windows": "^0.2.0", - "which": "^1.2.12" - }, - "dependencies": { - "is-windows": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", - "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", - "dev": true - } + "is-windows": "^1.0.1", + "which": "^1.2.14" } }, "globals": { @@ -7903,7 +7557,7 @@ "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=" + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" }, "gry": { "version": "4.3.1", @@ -7952,7 +7606,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -7974,8 +7627,7 @@ "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" }, "has-unicode": { "version": "2.0.1", @@ -8032,9 +7684,9 @@ } }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" }, "highlight.js": { "version": "9.14.1", @@ -8053,10 +7705,9 @@ "dev": true }, "homedir-polyfill": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", - "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", - "dev": true, + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", "requires": { "parse-passwd": "^1.0.0" } @@ -8547,8 +8198,7 @@ "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" }, "is-data-descriptor": { "version": "0.1.4", @@ -8571,8 +8221,7 @@ "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-descriptor": { "version": "0.1.6", @@ -8597,21 +8246,6 @@ "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", "dev": true }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -8724,18 +8358,6 @@ "isobject": "^3.0.1" } }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -8756,7 +8378,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, "requires": { "has": "^1.0.1" } @@ -8806,7 +8427,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, "requires": { "has-symbols": "^1.0.0" } @@ -8840,6 +8460,12 @@ "unc-path-regex": "^0.1.2" } }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -8913,21 +8539,21 @@ } }, "istanbul-lib-coverage": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", - "integrity": "sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", + "integrity": "sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw==" }, "istanbul-lib-instrument": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.0.0.tgz", - "integrity": "sha512-eQY9vN9elYjdgN9Iv6NS/00bptm02EBBk70lRMaVjeA6QYocQgenVrSgC28TJurdnZa80AGO3ASdFN+w/njGiQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz", + "integrity": "sha512-ooVllVGT38HIk8MxDj/OIHXSYvH+1tq/Vb38s8ixt9GoJadXska4WkGY+0wkmtYCZNYtaARniH/DixUGGLZ0uA==", "requires": { "@babel/generator": "^7.0.0", "@babel/parser": "^7.0.0", "@babel/template": "^7.0.0", "@babel/traverse": "^7.0.0", "@babel/types": "^7.0.0", - "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", "semver": "^5.5.0" } }, @@ -8943,6 +8569,33 @@ "integrity": "sha512-CpKJh9VRNhS+XqZtg1UMejETGEiqwCGDC/uwPEEQwc2nfdbSm73SIE29TplG2gLYuBOOTNDqxzG6A9NtEPLt0w==", "dev": true }, + "js-beautify": { + "version": "1.8.9", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.8.9.tgz", + "integrity": "sha512-MwPmLywK9RSX0SPsUJjN7i+RQY9w/yC17Lbrq9ViEefpLRgqAR2BgrMN2AbifkUuhDV8tRauLhLda/9+bE0YQA==", + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.2", + "glob": "^7.1.3", + "mkdirp": "~0.5.0", + "nopt": "~4.0.1" + }, + "dependencies": { + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -8959,7 +8612,6 @@ "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -9382,11 +9034,6 @@ "integrity": "sha1-+CbJtOKoUR2E46yinbBeGk87cqk=", "dev": true }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" - }, "lodash.escaperegexp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", @@ -9504,6 +9151,14 @@ "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", "dev": true }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "requires": { + "chalk": "^2.0.1" + } + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -9574,7 +9229,6 @@ "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, "requires": { "p-defer": "^1.0.0" } @@ -9599,9 +9253,9 @@ } }, "marked": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.0.tgz", - "integrity": "sha512-HduzIW2xApSXKXJSpCipSxKyvMbwRRa/TwMbepmlZziKdH8548WSoDP4SxzulEKjlo8BE39l+2fwJZuRKOln6g==" + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.1.tgz", + "integrity": "sha512-+H0L3ibcWhAZE02SKMqmvYsErLo4EAVJxu5h3bHBBDvvjeWXtl92rGUSBYHL2++5Y+RSNgl8dYOAXcYe7lp1fA==" }, "marked-terminal": { "version": "3.2.0", @@ -9617,15 +9271,9 @@ "supports-hyperlinks": "^1.0.1" } }, - "math-random": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", - "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", - "dev": true - }, "md5.js": { "version": "1.3.4", - "resolved": "http://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "requires": { "hash-base": "^3.0.0", @@ -9866,36 +9514,210 @@ "integrity": "sha1-dVSm+Nhxg0zJe1RisSLEwSTW3pE=" }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha1-bYrlCPWRZ/lA8rWzxKYSrlDJCuY=", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.0.1.tgz", + "integrity": "sha512-tQzCxWqxSD6Oyg5r7Ptbev0yAMD8p+Vfh4snPFuiUsWqYj0eVYTDT2DkEY307FTj0WRlIWN9rWMMAUzRmijgVQ==", "requires": { + "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", + "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "findup-sync": "2.0.0", + "glob": "7.1.3", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "3.12.0", + "log-symbols": "2.2.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "ms": "2.1.1", + "node-environment-flags": "1.0.4", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "12.0.5", + "yargs-parser": "11.1.1", + "yargs-unparser": "1.5.0" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } + "ms": "^2.1.1" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "mem": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.1.0.tgz", + "integrity": "sha512-I5u6Q1x7wxO0kdOpYBB28xueHADYps5uty/zg936CiG8NTe5sJL8EjrCuLneuDW3PlMdZBGDIn8BirEVdovZvg==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^2.0.0" + } + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "p-limit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==" + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } @@ -10193,21 +10015,21 @@ } }, "ngrok": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ngrok/-/ngrok-3.1.0.tgz", - "integrity": "sha512-8eui7ZJkBaczrl8FS4m7G2qh8JJYUOeznE7UsJAbeGuktGtb6aWXiCGqbgngqK/l0S4jue1JIgIZbFtbMJMv6A==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/ngrok/-/ngrok-3.1.1.tgz", + "integrity": "sha512-dCW/Ni12GRBL7XIyiFmilKOfCW7UVFf65I/HpE8FC5rXGJwdhIYLc9Qr05GRb6hNs6fZGwyLpcDLnDhUSgZasQ==", "requires": { "@types/node": "^8.10.30", - "decompress-zip": "^0.3.1", + "decompress-zip": "^0.3.2", "request": "^2.88.0", "request-promise-native": "^1.0.5", "uuid": "^3.3.2" }, "dependencies": { "@types/node": { - "version": "8.10.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.36.tgz", - "integrity": "sha512-SL6KhfM7PTqiFmbCW3eVNwVBZ+88Mrzbuvn9olPsfv43mbiWaFY+nRcz/TGGku0/lc2FepdMbImdMY1JrQ+zbw==" + "version": "8.10.40", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.40.tgz", + "integrity": "sha512-RRSjdwz63kS4u7edIwJUn8NqKLLQ6LyqF/X4+4jp38MBT3Vwetewi2N4dgJEshLbDwNgOJXNYoOwzVZUSSLhkQ==" } } }, @@ -10251,6 +10073,14 @@ "lodash.toarray": "^4.4.0" } }, + "node-environment-flags": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.4.tgz", + "integrity": "sha512-M9rwCnWVLW7PX+NUWe3ejEdiLYinRpsEre9hMkU/6NS4h+EEulYaDH1gCEZ2gyXsmw+RXYDaV2JkkTNcsPDJ0Q==", + "requires": { + "object.getownpropertydescriptors": "^2.0.3" + } + }, "node-fetch": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", @@ -10325,12 +10155,9 @@ } }, "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "requires": { - "remove-trailing-separator": "^1.0.1" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, "normalize-url": { "version": "3.3.0", @@ -13588,56 +13415,41 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nwsapi": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.9.tgz", - "integrity": "sha512-nlWFSCTYQcHk/6A9FFnfhKc14c3aFhfdNBXgo8Qgi9QTBu/qg3Ww+Uiz9wMzXd1T8GFxPc2QIHB6Qtf2XFryFQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.0.tgz", + "integrity": "sha512-ZG3bLAvdHmhIjaQ/Db1qvBxsGvFMLIRpQszyqbg31VJ53UP++uZX1/gf3Ut96pdwN9AuDwlMqIYLm0UPCdUeHg==" }, "nyc": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-13.1.0.tgz", - "integrity": "sha512-3GyY6TpQ58z9Frpv4GMExE1SV2tAgYqC7HSy2omEhNiCT3mhT9NyiOvIE8zkbuJVFzmvvNTnE4h/7/wQae7xLg==", + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-13.3.0.tgz", + "integrity": "sha512-P+FwIuro2aFG6B0Esd9ZDWUd51uZrAEoGutqZxzrVmYl3qSfkLgcQpBPBjtDFsUQLFY1dvTQJPOyeqr8S9GF8w==", "requires": { "archy": "^1.0.0", "arrify": "^1.0.1", - "caching-transform": "^2.0.0", + "caching-transform": "^3.0.1", "convert-source-map": "^1.6.0", - "debug-log": "^1.0.1", "find-cache-dir": "^2.0.0", "find-up": "^3.0.0", "foreground-child": "^1.5.6", "glob": "^7.1.3", - "istanbul-lib-coverage": "^2.0.1", - "istanbul-lib-hook": "^2.0.1", - "istanbul-lib-instrument": "^3.0.0", - "istanbul-lib-report": "^2.0.2", - "istanbul-lib-source-maps": "^2.0.1", - "istanbul-reports": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", + "istanbul-lib-hook": "^2.0.3", + "istanbul-lib-instrument": "^3.1.0", + "istanbul-lib-report": "^2.0.4", + "istanbul-lib-source-maps": "^3.0.2", + "istanbul-reports": "^2.1.1", "make-dir": "^1.3.0", "merge-source-map": "^1.1.0", "resolve-from": "^4.0.0", - "rimraf": "^2.6.2", + "rimraf": "^2.6.3", "signal-exit": "^3.0.2", "spawn-wrap": "^1.4.2", - "test-exclude": "^5.0.0", + "test-exclude": "^5.1.0", "uuid": "^3.3.2", - "yargs": "11.1.0", - "yargs-parser": "^9.0.2" + "yargs": "^12.0.5", + "yargs-parser": "^11.1.1" }, "dependencies": { - "align-text": { - "version": "0.1.4", - "bundled": true, - "optional": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - } - }, - "amdefine": { - "version": "1.0.1", - "bundled": true - }, "ansi-regex": { "version": "3.0.0", "bundled": true @@ -13658,8 +13470,11 @@ "bundled": true }, "async": { - "version": "1.5.2", - "bundled": true + "version": "2.6.2", + "bundled": true, + "requires": { + "lodash": "^4.17.11" + } }, "balanced-match": { "version": "1.0.0", @@ -13673,55 +13488,38 @@ "concat-map": "0.0.1" } }, - "builtin-modules": { - "version": "1.1.1", - "bundled": true - }, "caching-transform": { - "version": "2.0.0", + "version": "3.0.1", "bundled": true, "requires": { - "make-dir": "^1.0.0", - "md5-hex": "^2.0.0", - "package-hash": "^2.0.0", - "write-file-atomic": "^2.0.0" + "hasha": "^3.0.0", + "make-dir": "^1.3.0", + "package-hash": "^3.0.0", + "write-file-atomic": "^2.3.0" } }, "camelcase": { - "version": "1.2.1", - "bundled": true, - "optional": true - }, - "center-align": { - "version": "0.1.3", - "bundled": true, - "optional": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - } + "version": "5.0.0", + "bundled": true }, "cliui": { - "version": "2.1.0", + "version": "4.1.0", "bundled": true, - "optional": true, "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "bundled": true, - "optional": true - } + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" } }, "code-point-at": { "version": "1.1.0", "bundled": true }, + "commander": { + "version": "2.17.1", + "bundled": true, + "optional": true + }, "commondir": { "version": "1.0.1", "bundled": true @@ -13746,16 +13544,12 @@ } }, "debug": { - "version": "3.1.0", + "version": "4.1.1", "bundled": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "debug-log": { - "version": "1.0.1", - "bundled": true - }, "decamelize": { "version": "1.2.0", "bundled": true @@ -13767,6 +13561,13 @@ "strip-bom": "^3.0.0" } }, + "end-of-stream": { + "version": "1.4.1", + "bundled": true, + "requires": { + "once": "^1.4.0" + } + }, "error-ex": { "version": "1.3.2", "bundled": true, @@ -13779,11 +13580,11 @@ "bundled": true }, "execa": { - "version": "0.7.0", + "version": "1.0.0", "bundled": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", @@ -13792,10 +13593,12 @@ }, "dependencies": { "cross-spawn": { - "version": "5.1.0", + "version": "6.0.5", "bundled": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -13835,8 +13638,11 @@ "bundled": true }, "get-stream": { - "version": "3.0.0", - "bundled": true + "version": "4.1.0", + "bundled": true, + "requires": { + "pump": "^3.0.0" + } }, "glob": { "version": "7.1.3", @@ -13851,25 +13657,22 @@ } }, "graceful-fs": { - "version": "4.1.11", + "version": "4.1.15", "bundled": true }, "handlebars": { - "version": "4.0.11", + "version": "4.1.0", "bundled": true, "requires": { - "async": "^1.4.0", + "async": "^2.5.0", "optimist": "^0.6.1", - "source-map": "^0.4.4", - "uglify-js": "^2.6" + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" }, "dependencies": { "source-map": { - "version": "0.4.4", - "bundled": true, - "requires": { - "amdefine": ">=0.0.4" - } + "version": "0.6.1", + "bundled": true } } }, @@ -13877,6 +13680,13 @@ "version": "3.0.0", "bundled": true }, + "hasha": { + "version": "3.0.0", + "bundled": true, + "requires": { + "is-stream": "^1.0.1" + } + }, "hosted-git-info": { "version": "2.7.1", "bundled": true @@ -13898,25 +13708,13 @@ "bundled": true }, "invert-kv": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true }, "is-arrayish": { "version": "0.2.1", "bundled": true }, - "is-buffer": { - "version": "1.1.6", - "bundled": true, - "optional": true - }, - "is-builtin-module": { - "version": "1.0.0", - "bundled": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "bundled": true @@ -13930,31 +13728,40 @@ "bundled": true }, "istanbul-lib-coverage": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true }, "istanbul-lib-hook": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true, "requires": { "append-transform": "^1.0.0" } }, "istanbul-lib-report": { - "version": "2.0.2", + "version": "2.0.4", "bundled": true, "requires": { - "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", "make-dir": "^1.3.0", - "supports-color": "^5.4.0" + "supports-color": "^6.0.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "bundled": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "istanbul-lib-source-maps": { - "version": "2.0.1", + "version": "3.0.2", "bundled": true, "requires": { - "debug": "^3.1.0", - "istanbul-lib-coverage": "^2.0.1", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.3", "make-dir": "^1.3.0", "rimraf": "^2.6.2", "source-map": "^0.6.1" @@ -13967,34 +13774,21 @@ } }, "istanbul-reports": { - "version": "2.0.1", + "version": "2.1.1", "bundled": true, "requires": { - "handlebars": "^4.0.11" + "handlebars": "^4.1.0" } }, "json-parse-better-errors": { "version": "1.0.2", "bundled": true }, - "kind-of": { - "version": "3.2.2", - "bundled": true, - "optional": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lazy-cache": { - "version": "1.0.4", - "bundled": true, - "optional": true - }, "lcid": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "^2.0.0" } }, "load-json-file": { @@ -14015,17 +13809,16 @@ "path-exists": "^3.0.0" } }, + "lodash": { + "version": "4.17.11", + "bundled": true + }, "lodash.flattendeep": { "version": "4.4.0", "bundled": true }, - "longest": { - "version": "1.0.1", - "bundled": true, - "optional": true - }, "lru-cache": { - "version": "4.1.3", + "version": "4.1.5", "bundled": true, "requires": { "pseudomap": "^1.0.2", @@ -14039,22 +13832,20 @@ "pify": "^3.0.0" } }, - "md5-hex": { - "version": "2.0.0", + "map-age-cleaner": { + "version": "0.1.3", "bundled": true, "requires": { - "md5-o-matic": "^0.1.1" + "p-defer": "^1.0.0" } }, - "md5-o-matic": { - "version": "0.1.1", - "bundled": true - }, "mem": { - "version": "1.1.0", + "version": "4.1.0", "bundled": true, "requires": { - "mimic-fn": "^1.0.0" + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^2.0.0" } }, "merge-source-map": { @@ -14099,15 +13890,19 @@ } }, "ms": { - "version": "2.0.0", + "version": "2.1.1", + "bundled": true + }, + "nice-try": { + "version": "1.0.5", "bundled": true }, "normalize-package-data": { - "version": "2.4.0", + "version": "2.5.0", "bundled": true, "requires": { "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", + "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } @@ -14143,20 +13938,28 @@ "bundled": true }, "os-locale": { - "version": "2.1.0", + "version": "3.1.0", "bundled": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" } }, + "p-defer": { + "version": "1.0.0", + "bundled": true + }, "p-finally": { "version": "1.0.0", "bundled": true }, - "p-limit": { + "p-is-promise": { "version": "2.0.0", + "bundled": true + }, + "p-limit": { + "version": "2.1.0", "bundled": true, "requires": { "p-try": "^2.0.0" @@ -14174,12 +13977,12 @@ "bundled": true }, "package-hash": { - "version": "2.0.0", + "version": "3.0.0", "bundled": true, "requires": { - "graceful-fs": "^4.1.11", + "graceful-fs": "^4.1.15", + "hasha": "^3.0.0", "lodash.flattendeep": "^4.4.0", - "md5-hex": "^2.0.0", "release-zalgo": "^1.0.0" } }, @@ -14203,6 +14006,10 @@ "version": "2.0.1", "bundled": true }, + "path-parse": { + "version": "1.0.6", + "bundled": true + }, "path-type": { "version": "3.0.0", "bundled": true, @@ -14225,6 +14032,14 @@ "version": "1.0.2", "bundled": true }, + "pump": { + "version": "3.0.0", + "bundled": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "read-pkg": { "version": "3.0.0", "bundled": true, @@ -14249,11 +14064,6 @@ "es6-error": "^4.0.1" } }, - "repeat-string": { - "version": "1.6.1", - "bundled": true, - "optional": true - }, "require-directory": { "version": "2.1.1", "bundled": true @@ -14262,23 +14072,22 @@ "version": "1.0.1", "bundled": true }, + "resolve": { + "version": "1.10.0", + "bundled": true, + "requires": { + "path-parse": "^1.0.6" + } + }, "resolve-from": { "version": "4.0.0", "bundled": true }, - "right-align": { - "version": "0.1.3", - "bundled": true, - "optional": true, - "requires": { - "align-text": "^0.1.1" - } - }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { @@ -14286,7 +14095,7 @@ "bundled": true }, "semver": { - "version": "5.5.0", + "version": "5.6.0", "bundled": true }, "set-blocking": { @@ -14308,11 +14117,6 @@ "version": "3.0.2", "bundled": true }, - "source-map": { - "version": "0.5.7", - "bundled": true, - "optional": true - }, "spawn-wrap": { "version": "1.4.2", "bundled": true, @@ -14326,7 +14130,7 @@ } }, "spdx-correct": { - "version": "3.0.0", + "version": "3.1.0", "bundled": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -14334,7 +14138,7 @@ } }, "spdx-exceptions": { - "version": "2.1.0", + "version": "2.2.0", "bundled": true }, "spdx-expression-parse": { @@ -14346,7 +14150,7 @@ } }, "spdx-license-ids": { - "version": "3.0.0", + "version": "3.0.3", "bundled": true }, "string-width": { @@ -14372,15 +14176,8 @@ "version": "1.0.0", "bundled": true }, - "supports-color": { - "version": "5.4.0", - "bundled": true, - "requires": { - "has-flag": "^3.0.0" - } - }, "test-exclude": { - "version": "5.0.0", + "version": "5.1.0", "bundled": true, "requires": { "arrify": "^1.0.1", @@ -14390,39 +14187,27 @@ } }, "uglify-js": { - "version": "2.8.29", + "version": "3.4.9", "bundled": true, "optional": true, "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" + "commander": "~2.17.1", + "source-map": "~0.6.1" }, "dependencies": { - "yargs": { - "version": "3.10.0", + "source-map": { + "version": "0.6.1", "bundled": true, - "optional": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } + "optional": true } } }, - "uglify-to-browserify": { - "version": "1.0.2", - "bundled": true, - "optional": true - }, "uuid": { "version": "3.3.2", "bundled": true }, "validate-npm-package-license": { - "version": "3.0.3", + "version": "3.0.4", "bundled": true, "requires": { "spdx-correct": "^3.0.0", @@ -14440,11 +14225,6 @@ "version": "2.0.0", "bundled": true }, - "window-size": { - "version": "0.1.0", - "bundled": true, - "optional": true - }, "wordwrap": { "version": "0.0.3", "bundled": true @@ -14491,7 +14271,7 @@ "bundled": true }, "write-file-atomic": { - "version": "2.3.0", + "version": "2.4.2", "bundled": true, "requires": { "graceful-fs": "^4.1.11", @@ -14500,7 +14280,7 @@ } }, "y18n": { - "version": "3.2.1", + "version": "4.0.0", "bundled": true }, "yallist": { @@ -14508,78 +14288,29 @@ "bundled": true }, "yargs": { - "version": "11.1.0", + "version": "12.0.5", "bundled": true, "requires": { "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "os-locale": "^3.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - }, - "dependencies": { - "cliui": { - "version": "4.1.0", - "bundled": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "bundled": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "bundled": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "bundled": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "bundled": true - } + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" } }, "yargs-parser": { - "version": "9.0.2", + "version": "11.1.1", "bundled": true, "requires": { - "camelcase": "^4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true - } + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } @@ -14625,8 +14356,7 @@ "object-keys": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" }, "object-visit": { "version": "1.0.1", @@ -14636,14 +14366,24 @@ "isobject": "^3.0.0" } }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" } }, "object.pick": { @@ -14819,8 +14559,7 @@ "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" }, "p-filter": { "version": "1.0.0", @@ -14839,8 +14578,7 @@ "p-is-promise": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.0.0.tgz", - "integrity": "sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg==", - "dev": true + "integrity": "sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg==" }, "p-limit": { "version": "1.3.0", @@ -14938,35 +14676,6 @@ "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", "dev": true }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, "parse-it": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/parse-it/-/parse-it-1.0.8.tgz", @@ -14988,8 +14697,7 @@ "parse-passwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", - "dev": true + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" }, "parse-url": { "version": "1.3.11", @@ -15283,12 +14991,6 @@ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, "prettier-standard": { "version": "9.1.1", "resolved": "https://registry.npmjs.org/prettier-standard/-/prettier-standard-9.1.1.tgz", @@ -15411,6 +15113,11 @@ "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=" }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, "protocols": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.6.tgz", @@ -15518,25 +15225,6 @@ "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==", "dev": true }, - "randomatic": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", - "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", - "dev": true, - "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, "range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -15672,14 +15360,13 @@ } }, "readdirp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", - "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", "requires": { - "graceful-fs": "^4.1.2", - "minimatch": "^3.0.2", - "readable-stream": "^2.0.2", - "set-immediate-shim": "^1.0.1" + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" } }, "readline": { @@ -15767,15 +15454,6 @@ "private": "^0.1.6" } }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", - "dev": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, "regex-escape": { "version": "3.4.8", "resolved": "https://registry.npmjs.org/regex-escape/-/regex-escape-3.4.8.tgz", @@ -16068,14 +15746,29 @@ } }, "request-promise": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.2.tgz", - "integrity": "sha1-0epG1lSm7k+O5qT+oQGMIpEZBLQ=", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.4.tgz", + "integrity": "sha512-8wgMrvE546PzbR5WbYxUQogUnUDfM0S7QIFZMID+J73vdFARkFy+HElj4T+MWYhpXwlLp0EQ8Zoj8xUA0he4Vg==", "requires": { "bluebird": "^3.5.0", - "request-promise-core": "1.1.1", - "stealthy-require": "^1.1.0", - "tough-cookie": ">=2.3.3" + "request-promise-core": "1.1.2", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "request-promise-core": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", + "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "requires": { + "lodash": "^4.17.11" + } + } } }, "request-promise-core": { @@ -16087,13 +15780,28 @@ } }, "request-promise-native": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", - "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", + "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", "requires": { - "request-promise-core": "1.1.1", - "stealthy-require": "^1.1.0", - "tough-cookie": ">=2.3.3" + "request-promise-core": "1.1.2", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "request-promise-core": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", + "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "requires": { + "lodash": "^4.17.11" + } + } } }, "require-directory": { @@ -16136,13 +15844,12 @@ } }, "resolve-dir": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", - "integrity": "sha1-shklmlYC+sXFxJatiUpujMQwJh4=", - "dev": true, + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", "requires": { - "expand-tilde": "^1.2.2", - "global-modules": "^0.2.3" + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" } }, "resolve-from": { @@ -16692,11 +16399,6 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" - }, "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", @@ -16768,6 +16470,11 @@ } } }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -17218,9 +16925,9 @@ } }, "sprintf-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz", - "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" }, "sqlite3": { "version": "4.0.6", @@ -17661,9 +17368,9 @@ } }, "swagger-client": { - "version": "3.8.22", - "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.8.22.tgz", - "integrity": "sha512-Jm+X3p6B6hvdSIZ3hJRltrHP2z3if6zt+fmYZaFwyAiPt6IU25PHkipqC92KSCy/pK2bpo9ZQfmphFEtuGc3ig==", + "version": "3.8.24", + "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.8.24.tgz", + "integrity": "sha512-XFPOEz+IUPqIlYne2VAglYqqFBUykQvcVtfWbaE3BEu1xjAvCk1G873vj3NVQ0qR+2P1xq4VYMLCHqfqNGsLRA==", "requires": { "@kyleshockey/js-yaml": "^1.0.1", "@kyleshockey/object-assign-deep": "^0.4.0", @@ -17740,9 +17447,9 @@ } }, "tedious": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/tedious/-/tedious-4.1.3.tgz", - "integrity": "sha512-GM6iglXiil+DDXYezbEUTIhqRUxR4vL4Dz1wQKHegkhPGRMWoIl34Vk3esFUaD5B030Ce+pZoc7iky++MOADTA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tedious/-/tedious-5.0.3.tgz", + "integrity": "sha512-GSGmm7+o+5Zzi2vSKIKkC+8J4uRc9wOR+DZ3LTecz8quTpA+5KAd2cmfbENxi7dTWTP3ARobpY3jchBqbbo4WQ==", "requires": { "adal-node": "^0.1.22", "big-number": "1.0.0", @@ -18343,17 +18050,17 @@ "integrity": "sha512-BJONvKQWolyNqnzjKQIJflsuvyjapsCPR07maHiRvUOXIbhY56SqmYs+VKevq7SIFXsnlfTEE7meP+6Y/Q2Pyw==" }, "typedoc-plugin-markdown": { - "version": "1.1.25", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-1.1.25.tgz", - "integrity": "sha512-mnKsyNPwQtyeyeHCP3KJlzr/Glwv1yfNYEdQFHqJORTbrXy5M8IwPBAzVdUxQvdg16cvHHwUweeBOnTV98ZtxA==", + "version": "1.1.26", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-1.1.26.tgz", + "integrity": "sha512-OMl3HU346gGmPpaHndjHdMWVm6zdR1iSSRgd+Q0mMT4s2f5mijkZSrCe1SFr9meZG8bPMeQo+gNUZ36pGdL6iA==", "requires": { "turndown": "^5.0.3" } }, "typescript": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.1.tgz", - "integrity": "sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA==" + "version": "3.3.3333", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3333.tgz", + "integrity": "sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==" }, "typpy": { "version": "2.3.10", @@ -18547,7 +18254,7 @@ "upath": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", - "integrity": "sha1-NSVll+RqWB20eT0M5H+prr/J+r0=" + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==" }, "update-notifier": { "version": "2.3.0", @@ -18707,7 +18414,7 @@ }, "validator": { "version": "9.4.1", - "resolved": "http://registry.npmjs.org/validator/-/validator-9.4.1.tgz", + "resolved": "https://registry.npmjs.org/validator/-/validator-9.4.1.tgz", "integrity": "sha512-YV5KjzvRmSyJ1ee/Dm5UED0G+1L4GZnLN3w6/T+zZm8scVua4sOhYKWTUrKa0H/tMiJyO9QLHMPN+9mB/aMunA==" }, "vary": { @@ -19049,7 +18756,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "xmldom": { @@ -19140,6 +18847,171 @@ } } }, + "yargs-unparser": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", + "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.11", + "yargs": "^12.0.5" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "mem": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.1.0.tgz", + "integrity": "sha512-I5u6Q1x7wxO0kdOpYBB28xueHADYps5uty/zg936CiG8NTe5sJL8EjrCuLneuDW3PlMdZBGDIn8BirEVdovZvg==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^2.0.0" + } + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "p-limit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==" + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "yn": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/yn/-/yn-3.0.0.tgz", diff --git a/package.json b/package.json index 10cd7ef8..4863fb4b 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@microsoft/microsoft-graph-client": "1.4.0", "@semantic-release/exec": "^3.3.2", "adal-node": "0.1.28", - "async": "2.6.1", + "async": "2.6.2", "async-promises": "0.2.1", "azure-arm-cognitiveservices": "2.4.1", "azure-arm-resource": "7.3.0", @@ -60,39 +60,39 @@ "azure-arm-website": "5.7.0", "bluebird": "^3.5.3", "body-parser": "1.18.3", - "botbuilder": "^4.1.7", - "botbuilder-ai": "^4.2.0", - "botbuilder-azure": "^4.2.0", + "botbuilder": "^4.2.1", + "botbuilder-ai": "^4.2.1", + "botbuilder-azure": "^4.2.1", "botbuilder-choices": "^4.0.0-preview1.2", - "botbuilder-dialogs": "^4.2.0", + "botbuilder-dialogs": "^4.2.1", "botbuilder-prompts": "^4.0.0-preview1.2", - "botlib": "^0.1.10", + "botlib": "^0.1.12", "chai": "4.2.0", "child_process": "^1.0.2", - "chokidar": "2.0.4", + "chokidar": "2.1.2", "cli-spinner": "^0.2.8", - "csv-parse": "4.3.1", + "csv-parse": "4.3.3", "dotenv-extended": "2.3.0", "express": "4.16.4", "express-promise-router": "3.0.3", "fs-extra": "7.0.1", - "fs-walk": "0.0.2", "ip": "^1.1.5", + "js-beautify": "^1.8.9", "localize": "0.4.7", - "marked": "0.6.0", - "mocha": "5.2.0", + "marked": "0.6.1", + "mocha": "6.0.1", "mocha-typescript": "1.1.17", "ms": "2.1.1", "ms-rest-azure": "2.6.0", "nexmo": "2.4.1", - "ngrok": "^3.1.0", - "nyc": "^13.1.0", + "ngrok": "^3.1.1", + "nyc": "^13.3.0", "opn": "^5.4.0", "pragmatismo-io-framework": "1.0.19", "process-exists": "^3.1.0", "public-ip": "^3.0.0", "reflect-metadata": "0.1.13", - "request-promise-native": "1.0.5", + "request-promise-native": "1.0.7", "scanf": "^1.0.2", "sequelize": "4.42.0", "sequelize-typescript": "0.6.7", @@ -100,13 +100,13 @@ "simple-git": "^1.107.0", "sqlite3": "4.0.6", "strict-password-generator": "^1.1.2", - "swagger-client": "3.8.22", - "tedious": "4.1.3", + "swagger-client": "3.8.24", + "tedious": "5.0.3", "ts-node": "8.0.2", "typedoc": "0.14.2", "typedoc-plugin-external-module-name": "^2.0.0", - "typedoc-plugin-markdown": "^1.1.25", - "typescript": "3.3.1", + "typedoc-plugin-markdown": "^1.1.26", + "typescript": "3.3.3333", "url-join": "4.0.0", "vbscript-to-typescript": "^1.0.8", "wait-until": "0.0.2", @@ -121,13 +121,13 @@ "@semantic-release/npm": "^5.1.4", "@semantic-release/release-notes-generator": "^7.1.4", "@types/chai": "4.1.7", - "@types/mocha": "5.2.5", - "@types/sequelize": "4.27.34", + "@types/mocha": "5.2.6", + "@types/sequelize": "4.27.37", "@types/url-join": "4.0.0", "@types/winston": "2.4.4", "ban-sensitive-files": "1.9.2", - "commitizen": "^3.0.5", - "coveralls": "^3.0.2", + "commitizen": "^3.0.7", + "coveralls": "^3.0.3", "cz-conventional-changelog": "^2.1.0", "dependency-check": "3.3.0", "deps-ok": "1.4.1", diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index 4d3b4a03..c3473f20 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -178,7 +178,7 @@ export class AdminDialog extends IGBDialog { ); } - private static setupSecurityDialogs(min: any) { + private static setupSecurityDialogs(min: GBMinInstance) { min.dialogs.add( new WaterfallDialog('/setupSecurity', [ async step => { diff --git a/packages/console.gblib/services/ConsoleDirectLine.ts b/packages/console.gblib/services/ConsoleDirectLine.ts index a15768f0..9cf41844 100644 --- a/packages/console.gblib/services/ConsoleDirectLine.ts +++ b/packages/console.gblib/services/ConsoleDirectLine.ts @@ -36,7 +36,6 @@ const _ = require('lodash'); const Parse = require('csv-parse'); const Async = require('async'); const UrlJoin = require('url-join'); -const Walk = require('fs-walk'); const logger = require('../../../src/logger'); const Swagger = require('swagger-client'); const rp = require('request-promise'); diff --git a/packages/core.gbapp/services/GBAPIService.ts b/packages/core.gbapp/services/GBAPIService.ts index 85f3ad5a..d1a2e64f 100644 --- a/packages/core.gbapp/services/GBAPIService.ts +++ b/packages/core.gbapp/services/GBAPIService.ts @@ -35,6 +35,7 @@ import { TurnContext } from 'botbuilder'; import { WaterfallStepContext } from 'botbuilder-dialogs'; import { GBMinInstance } from 'botlib'; +import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; const WaitUntil = require('wait-until'); class SysClass { @@ -44,7 +45,11 @@ class SysClass { this.min = min; } - public async deployBot( + public generatePassword(){ + return GBAdminService.getRndPassword(); + } + + public async createABotFarmUsing( botId, description, location, diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index cbed900d..1234aa89 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -231,7 +231,7 @@ export class GBDeployer { case '.gbdialog': const vm = new GBVMService(); - return vm.loadJS(localPath, min, this.core, this, localPath); + return vm.loadDialogPackage(localPath, min, this.core, this); default: const err = GBError.create(`GuaribasBusinessError: Unknown package type: ${packageType}.`); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index f0ad8c7e..6191e1c8 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -45,6 +45,7 @@ const AuthenticationContext = require('adal-node').AuthenticationContext; import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder'; +import { ConfirmPrompt } from 'botbuilder-dialogs'; import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBPackage } from 'botlib'; import { GBAnalyticsPackage } from '../../analytics.gblib'; import { GBCorePackage } from '../../core.gbapp'; @@ -56,7 +57,6 @@ import { GuaribasInstance } from '../models/GBModel'; import { Messages } from '../strings'; import { GBAdminPackage } from './../../admin.gbapp/index'; import { GBDeployer } from './GBDeployer'; -import { ConfirmPrompt } from 'botbuilder-dialogs'; /** Minimal service layer for a bot. */ @@ -108,7 +108,7 @@ export class GBMinService { const uiPackage = 'default.gbui'; server.use('/', express.static(UrlJoin(GBDeployer.deployFolder, uiPackage, 'build'))); - Promise.all( + await Promise.all( instances.map(async instance => { // Gets the authorization key for each instance from Bot Service. @@ -119,39 +119,7 @@ export class GBMinService { server.get('/instances/:botId', (req, res) => { (async () => { - // Returns the instance object to clients requesting bot info. - - let botId = req.params.botId; - if (botId === '[default]') { - botId = bootInstance.botId; - } - - const instance = await this.core.loadInstance(botId); - - if (instance) { - const speechToken = await this.getSTSToken(instance); - let theme = instance.theme; - if (!theme) { - theme = 'default.gbtheme'; - } - - res.send( - JSON.stringify({ - instanceId: instance.instanceId, - botId: botId, - theme: theme, - secret: instance.webchatKey, // TODO: Use token. - speechToken: speechToken, - conversationId: webchatToken.conversationId, - authenticatorTenant: instance.authenticatorTenant, - authenticatorClientId: instance.authenticatorClientId - }) - ); - } else { - const error = `Instance not found: ${botId}.`; - res.sendStatus(error); - logger.error(error); - } + await this.sendInstanceToClient(req, bootInstance, res, webchatToken); })(); }); @@ -171,7 +139,7 @@ export class GBMinService { const url = `/api/messages/${instance.botId}`; server.post(url, async (req, res) => { - return await this.receiver(adapter, req, res, conversationState, min, instance, appPackages); + await this.receiver(adapter, req, res, conversationState, min, instance, appPackages); }); logger.info(`GeneralBots(${instance.engineName}) listening on: ${url}.`); @@ -186,71 +154,94 @@ export class GBMinService { // Clients get redirected here in order to create an OAuth authorize url and redirect them to AAD. // There they will authenticate and give their consent to allow this app access to // some resource they own. - server.get(`/${min.instance.botId}/auth`, function(req, res) { - let authorizationUrl = UrlJoin( - min.instance.authenticatorAuthorityHostUrl, - min.instance.authenticatorTenant, - '/oauth2/authorize' - ); - authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${ - min.instance.authenticatorClientId - }&redirect_uri=${UrlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; - res.redirect(authorizationUrl); - }); + this.handleOAuthRequests(server, min); // After consent is granted AAD redirects here. The ADAL library // is invoked via the AuthenticationContext and retrieves an // access token that can be used to access the user owned resource. - server.get(`/${min.instance.botId}/token`, async (req, res) => { - const state = await min.adminService.getValue(min.instance.instanceId, 'AntiCSRFAttackState'); - - if (req.query.state !== state) { - const msg = 'WARNING: state field was not provided as anti-CSRF token'; - logger.error(msg); - throw new Error(msg); - } - - const authenticationContext = new AuthenticationContext( - UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant) - ); - - const resource = 'https://graph.microsoft.com'; - - authenticationContext.acquireTokenWithAuthorizationCode( - req.query.code, - UrlJoin(instance.botEndpoint, min.instance.botId, '/token'), - resource, - instance.authenticatorClientId, - instance.authenticatorClientSecret, - async (err, token) => { - if (err) { - const msg = `Error acquiring token: ${err}`; - logger.error(msg); - res.send(msg); - } else { - await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); - await this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); - await this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); - await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', null); - - res.redirect(min.instance.botEndpoint); - } - } - ); - }); + this.handleOAuthTokenRequests(server, min, instance); }) ); } + private handleOAuthTokenRequests(server: any, min: GBMinInstance, instance: GuaribasInstance) { + server.get(`/${min.instance.botId}/token`, async (req, res) => { + const state = await min.adminService.getValue(min.instance.instanceId, 'AntiCSRFAttackState'); + if (req.query.state !== state) { + const msg = 'WARNING: state field was not provided as anti-CSRF token'; + logger.error(msg); + throw new Error(msg); + } + const authenticationContext = new AuthenticationContext( + UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant)); + const resource = 'https://graph.microsoft.com'; + authenticationContext.acquireTokenWithAuthorizationCode( + req.query.code, UrlJoin(instance.botEndpoint, min.instance.botId, '/token'), + resource, instance.authenticatorClientId, instance.authenticatorClientSecret, async (err, token) => { + if (err) { + const msg = `Error acquiring token: ${err}`; + logger.error(msg); + res.send(msg); + } else { + await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); + await this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); + await this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); + await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', null); + res.redirect(min.instance.botEndpoint); + } + }); + }); + } + + private handleOAuthRequests(server: any, min: GBMinInstance) { + server.get(`/${min.instance.botId}/auth`, function (req, res) { + let authorizationUrl = UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant, '/oauth2/authorize'); + authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${min.instance.authenticatorClientId}&redirect_uri=${UrlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; + res.redirect(authorizationUrl); + }); + } + + /** + * Returns the instance object to clients requesting bot info. + */ + private async sendInstanceToClient(req, bootInstance: GuaribasInstance, res: any, webchatToken: any) { + let botId = req.params.botId; + if (botId === '[default]') { + botId = bootInstance.botId; + } + const instance = await this.core.loadInstance(botId); + if (instance) { + const speechToken = await this.getSTSToken(instance); + let theme = instance.theme; + if (!theme) { + theme = 'default.gbtheme'; + } + res.send(JSON.stringify({ + instanceId: instance.instanceId, + botId: botId, + theme: theme, + secret: instance.webchatKey, + speechToken: speechToken, + conversationId: webchatToken.conversationId, + authenticatorTenant: instance.authenticatorTenant, + authenticatorClientId: instance.authenticatorClientId + })); + } else { + const error = `Instance not found: ${botId}.`; + res.sendStatus(error); + logger.error(error); + } + } + /** * Get Webchat key from Bot Service. * * @param instance The Bot instance. * */ - public async getWebchatToken(instance: any) { + private async getWebchatToken(instance: any) { const options = { url: 'https://directline.botframework.com/v3/directline/tokens/generate', method: 'POST', @@ -276,7 +267,7 @@ export class GBMinService { * @param instance The general bot instance. * */ - public async getSTSToken(instance: any) { + private async getSTSToken(instance: any) { // TODO: Make dynamic: https://CHANGE.api.cognitive.microsoft.com/sts/v1.0 const options = { @@ -327,7 +318,7 @@ export class GBMinService { return { min, adapter, conversationState }; } - private invokeLoadBot(appPackages: any[], min: any, server: any) { + private invokeLoadBot(appPackages: any[], min: GBMinInstance, server: any) { const sysPackages = new Array(); // NOTE: A semicolon is necessary before this line. [ @@ -348,12 +339,12 @@ export class GBMinService { p.channel.received(req, res); }); } - }, this); + }, this); appPackages.forEach(e => { e.sysPackages = sysPackages; e.loadBot(min); - }, this); + }, this); } /** @@ -364,11 +355,13 @@ export class GBMinService { req: any, res: any, conversationState: ConversationState, - min: any, + min: GBMinInstance, instance: any, appPackages: any[] ) { - return await adapter.processActivity(req, res, async context => { + + await adapter.processActivity(req, res, async context => { + // Get loaded user state const state = await conversationState.get(context); const step = await min.dialogs.createContext(context, state); @@ -412,32 +405,7 @@ export class GBMinService { // Processes messages. } else if (context.activity.type === 'message') { // Checks for /admin request. - if (context.activity.text === 'alpha-vba') { - min.sandbox.context = context; - min.sandbox.step = step; - min.sandbox['bot'].bind(min.sandbox); - await min.sandbox['bot'](); - } else if (context.activity.text === 'admin') { - await step.beginDialog('/admin'); - - // Checks for /menu JSON signature. - } else if (context.activity.text.startsWith('{"title"')) { - await step.beginDialog('/menu', { - data: JSON.parse(context.activity.text) - }); - - // Otherwise, continue to the active dialog in the stack. - } else { - const user = await min.userProfile.get(context, {}); - - if (step.activeDialog) { - await step.continueDialog(); - } else { - await step.beginDialog('/answer', { - query: context.activity.text - }); - } - } + await this.processMessageActivity(context, min, step); // Processes events. } else if (context.activity.type === 'event') { @@ -445,31 +413,7 @@ export class GBMinService { // TODO: Understand MSFT changes: await step.endAll(); - if (context.activity.name === 'whoAmI') { - await step.beginDialog('/whoAmI'); - } else if (context.activity.name === 'showSubjects') { - await step.beginDialog('/menu'); - } else if (context.activity.name === 'giveFeedback') { - await step.beginDialog('/feedback', { - fromMenu: true - }); - } else if (context.activity.name === 'showFAQ') { - await step.beginDialog('/faq'); - } else if (context.activity.name === 'answerEvent') { - await step.beginDialog('/answerEvent', { - questionId: (context.activity as any).data, - fromFaq: true - }); - } else if (context.activity.name === 'quality') { - await step.beginDialog('/quality', { - score: (context.activity as any).data - }); - } else if (context.activity.name === 'updateToken') { - const token = (context.activity as any).data; - await step.beginDialog('/adminUpdateToken', { token: token }); - } else { - await step.continueDialog(); - } + await this.processEventActivity(context, step); } await conversationState.saveChanges(context, true); } catch (error) { @@ -481,4 +425,69 @@ export class GBMinService { } }); } + + private async processEventActivity(context, step: any) { + if (context.activity.name === 'whoAmI') { + await step.beginDialog('/whoAmI'); + } else if (context.activity.name === 'showSubjects') { + await step.beginDialog('/menu'); + } else if (context.activity.name === 'giveFeedback') { + await step.beginDialog('/feedback', { + fromMenu: true + }); + } else if (context.activity.name === 'showFAQ') { + await step.beginDialog('/faq'); + } else if (context.activity.name === 'answerEvent') { + await step.beginDialog('/answerEvent', { + questionId: (context.activity).data, + fromFaq: true + }); + } else if (context.activity.name === 'quality') { + await step.beginDialog('/quality', { + score: (context.activity).data + }); + } else if (context.activity.name === 'updateToken') { + const token = (context.activity).data; + await step.beginDialog('/adminUpdateToken', { token: token }); + } else { + await step.continueDialog(); + } + } + + private async processMessageActivity(context, min: GBMinInstance, step: any) { + + // Direct script invoking by itent name. + + let mainMethod = min.scriptMap[context.activity.text]; + if (mainMethod != undefined) { + min.sandbox.context = context; + min.sandbox.step = step; + min.sandbox[mainMethod].bind(min.sandbox); + await min.sandbox[mainMethod](); + + }else if (context.activity.text === 'admin') { + + await step.beginDialog('/admin'); + + // Checks for /menu JSON signature. + } else if (context.activity.text.startsWith('{"title"')) { + + await step.beginDialog('/menu', { + data: JSON.parse(context.activity.text) + }); + // Otherwise, continue to the active dialog in the stack. + + } else { + + const user = await min.userProfile.get(context, {}); + if (step.activeDialog) { + await step.continueDialog(); + } else { + await step.beginDialog('/answer', { + query: context.activity.text + }); + } + + } + } } diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index a016f362..3818f063 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -35,19 +35,22 @@ import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBCoreService } from 'botlib'; import * as fs from 'fs'; -import DialogClass from './GBAPIService'; import { GBDeployer } from './GBDeployer'; import { TSCompiler } from './TSCompiler'; -const util = require('util'); +import GBAPIService from './GBAPIService'; +import DialogClass from './GBAPIService'; +const walkPromise = require('walk-promise'); const logger = require('../../../src/logger'); const vm = require('vm'); const UrlJoin = require('url-join'); const vb2ts = require('vbscript-to-typescript/dist/converter'); +var beautify = require('js-beautify').js; /** * @fileoverview Virtualization services for emulation of BASIC. - * This alpha version is using a converter to translate BASIC to TS - * and string replacements to emulate await code. + * This alpha version is using a hack in form of converter to + * translate BASIC to TSand string replacements to emulate await code. + * See http://jsfiddle.net/roderick/dym05hsy for more info on vb2ts, so * http://stevehanov.ca/blog/index.php?id=92 should be used to run it without * translation and enhance classic BASIC experience. */ @@ -55,41 +58,95 @@ const vb2ts = require('vbscript-to-typescript/dist/converter'); export class GBVMService implements IGBCoreService { private readonly script = new vm.Script(); - public async loadJS( - filename: string, - min: GBMinInstance, - core: IGBCoreService, - deployer: GBDeployer, - localPath: string - ): Promise { - const path = 'packages/default.gbdialog'; - const file = 'bot.vbs'; - const source = UrlJoin(path, file); + public async loadDialogPackage(folder: string, min: GBMinInstance, core: IGBCoreService, deployer: GBDeployer) { + const files = await walkPromise(folder); - // Example when handled through fs.watch() listener - fs.watchFile(source, async (curr, prev) => { - await this.run(source, path, min, deployer, filename); - }); - await this.run(source, path, min, deployer, filename); - this.addHearDialog(min); + return Promise.all( + files.map(async file => { + if ( + file.name.endsWith('.vbs') || + file.name.endsWith('.vb') || + file.name.endsWith('.basic') || + file.name.endsWith('.bas') + ) { + const mainName = file.name.replace(/\-|\./g, ''); + // min.scriptMap[file.name] = ; + + const filename = UrlJoin(folder, file.name); + fs.watchFile(filename, async () => { + await this.run(filename, min, deployer, mainName); + }); + await this.run(filename, min, deployer, mainName); + this.addHearDialog(min); + } + }) + ); } - public async run(source: any, path: string, min: any, deployer: GBDeployer, filename: string) { - // Converts VBS into TS. + /** + * Converts General Bots BASIC + * + * + * @param code General Bots BASIC + */ + public convertGBASICToVBS(code: string) { + // Start and End of VB2TS tags of processing. - vb2ts.convertFile(source); + code = `<%\n${code}`; + + // Keywords from General Bots BASIC. + + code = code.replace(/(hear)\s*(\w+)/g, ($0, $1, $2) => { + return `${$2} = hear()`; + }); + + code = code.replace(/(wait)\s*(\d+)/g, ($0, $1, $2) => { + return `sys().wait(${$2})`; + }); + + code = code.replace(/(generate a password)/g, ($0, $1) => { + return 'let password = sys().generatePassword()'; + }); + + code = code.replace(/(create a bot farm using)(\s)(.*)/g, ($0, $1, $2, $3) => { + return `sys().createABotFarmUsing (${$3})`; + }); + + code = code.replace(/(talk)(\s)(.*)/g, ($0, $1, $2, $3) => { + return `talk (${$3})\n`; + }); + + code = `${code}\n%>`; + + return code; + } + + public async run(filename: any, min: GBMinInstance, deployer: GBDeployer, mainName: string) { + // Converts General Bots BASIC into regular VBS + + const basicCode: string = fs.readFileSync(filename, 'utf8'); + const vbsCode = await this.convertGBASICToVBS(basicCode); + const vbsFile = `${filename}.compiled`; + fs.writeFileSync(vbsFile, vbsCode, 'utf8'); + + // Converts VBS into TS. + vb2ts.convertFile(vbsFile); // Convert TS into JS. - const tsfile = `bot.ts`; + const tsfile: string = `${filename}.ts`; + let tsCode: string = fs.readFileSync(tsfile, 'utf8'); + tsCode = tsCode.replace(/export.*\n/g, `export function ${mainName}() {`); + fs.writeFileSync(tsfile, tsCode); + const tsc = new TSCompiler(); - tsc.compile([UrlJoin(path, tsfile)]); + tsc.compile([tsfile]); // Run JS into the GB context. - const jsfile = `bot.js`; - const localPath = UrlJoin(path, jsfile); + const jsfile = `${tsfile}.js`.replace('.ts', ''); + + if (fs.existsSync(jsfile)) { + let code: string = fs.readFileSync(jsfile, 'utf8'); - if (fs.existsSync(localPath)) { - let code: string = fs.readFileSync(localPath, 'utf8'); code = code.replace(/^.*exports.*$/gm, ''); // Finds all hear calls. @@ -104,7 +161,7 @@ export class GBVMService implements IGBCoreService { // Writes async body. - const variable = match1[1]; // variable = hear(); + const variable = match1[1]; // Construct variable = hear (). parsedCode = code.substring(pos, pos + match1.index); parsedCode += `hear (async (${variable}) => {\n`; @@ -146,22 +203,10 @@ export class GBVMService implements IGBCoreService { code = parsedCode; } - parsedCode = parsedCode.replace(/("[^"]*"|'[^']*')|\btalk\b/g, ($0, $1) => { - return $1 == undefined ? 'this.talk' : $1; - }); + parsedCode = this.handleThisAndAwait(parsedCode); - parsedCode = parsedCode.replace(/("[^"]*"|'[^']*')|\bhear\b/g, ($0, $1) => { - return $1 == undefined ? 'this.hear' : $1; - }); - - parsedCode = parsedCode.replace(/("[^"]*"|'[^']*')|\bsendEmail\b/g, ($0, $1) => { - return $1 == undefined ? 'this.sendEmail' : $1; - }); - - parsedCode = parsedCode.replace(/this\./gm, 'await this.'); - parsedCode = parsedCode.replace(/function/gm, 'async function'); - - fs.writeFileSync(localPath, parsedCode); + parsedCode = beautify(parsedCode, { indent_size: 2, space_in_empty_paren: true }) + fs.writeFileSync(jsfile, parsedCode); const sandbox: DialogClass = new DialogClass(min); const context = vm.createContext(sandbox); @@ -172,6 +217,28 @@ export class GBVMService implements IGBCoreService { } } + private handleThisAndAwait(code: string) { + // this insertion. + + code = code.replace(/sys\(\)/g, 'this.sys()'); + code = code.replace(/("[^"]*"|'[^']*')|\btalk\b/g, ($0, $1) => { + return $1 == undefined ? 'this.talk' : $1; + }); + code = code.replace(/("[^"]*"|'[^']*')|\bhear\b/g, ($0, $1) => { + return $1 == undefined ? 'this.hear' : $1; + }); + code = code.replace(/("[^"]*"|'[^']*')|\bsendEmail\b/g, ($0, $1) => { + return $1 == undefined ? 'this.sendEmail' : $1; + }); + + // await insertion. + + code = code.replace(/this\./gm, 'await this.'); + code = code.replace(/function/gm, 'async function'); + + return code; + } + private addHearDialog(min) { min.dialogs.add( new WaterfallDialog('/hear', [ diff --git a/packages/default.gbdialog/bot.vbs b/packages/default.gbdialog/bot.vbs index d81ccc15..f21417c8 100644 --- a/packages/default.gbdialog/bot.vbs +++ b/packages/default.gbdialog/bot.vbs @@ -1,54 +1,20 @@ -<% -'**************************************************************************** -' ( )_ _ -' _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ -' ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ -' | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) -' | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' -' | | ( )_) | -' (_) \___/' -' -' General Bots Copyright (c) Pragmatismo.io. All rights reserved. -' Licensed under the AGPL-3.0. -' -' This BASIC file is based on this JavaScript file by Rodrigo Ruotolo: -' -> http://jsfiddle.net/roderick/dym05hsy -' -' According to our dual licensing model, this program can be used either -' under the terms of the GNU Affero General Public License, version 3, -' or under a proprietary license. -' -' The texts of the GNU Affero General Public License with an additional -' permission and of our proprietary license can be found at and -' in the LICENSE file you have received along with this program. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY, without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Affero General Public License for more details. -' -' "General Bots" is a registered trademark of Pragmatismo.io. -' The licensing of the program under the AGPLv3 does not imply a -' trademark license. Therefore any rights, title and interest in -' our trademarks remain entirely with us. -' -'**************************************************************************** +' General Bots Copyright (c) Pragmatismo.io. All rights reserved. Licensed under the AGPL-3.0. -talk ("How many installments do you want to pay your Credit?") -installments = hear () +talk "How many installments do you want to pay your Credit?" +hear installments if installments > 60 then - talk ("The maximum number of payments is 60") + talk "The maximum number of payments is 60" else - talk ("What is the amount requested?") - ammount = hear () + talk "What is the amount requested?" + hear ammount if ammount >100000 then - talk ("We are sorry, we can only accept proposals bellow 100k") + talk "We are sorry, we can only accept proposals bellow 100k" else - talk ("What is the best due date?") - dueDate = hear () + talk "What is the best due date?" + hear dueDate interestRate = 0 adjustment = 0 @@ -84,15 +50,15 @@ else end if if installments > 60 then - talk ("The maximum number of payments is 60") + talk "The maximum number of payments is 60" end if ' TODO: This must be reviewed in terms of financing logic. - nInstallments = parseInt(installments) - vAmmount = parseFloat(ammount) - initialPayment = parseFloat(vAmmount) * 0.3 ' 30% of the value + nInstallments = parseIntinstallments + vAmmount = parseFloatammount + initialPayment = parseFloatvAmmount * 0.3 ' 30% of the value tac = 800 adjustment = 1.3 @@ -100,13 +66,12 @@ else paymentValue = totalValue * adjustment finalValue = paymentValue * nInstallments + initialPayment - talk("Congratulations! Your credit analysis is **done**:") - talk("First payment: **" + initialPayment + "**") - talk("Payment value: **" + paymentValue + "**") - talk("Interest Rate: **" + interestRate + "%**") - talk("Total Value: **" + totalValue + "**") - talk("Final Value: **" + finalValue + "**") + talk "Congratulations! Your credit analysis is **done**:" + talk "First payment: **" + initialPayment + "**" + talk "Payment value: **" + paymentValue + "**" + talk "Interest Rate: **" + interestRate + "%**" + talk "Total Value: **" + totalValue + "**" + talk "Final Value: **" + finalValue + "**" end if end if -%> \ No newline at end of file diff --git a/packages/default.gbdialog/sys-bot-farm-creation.vbs b/packages/default.gbdialog/sys-bot-farm-creation.vbs index c18b3305..7ab1d431 100644 --- a/packages/default.gbdialog/sys-bot-farm-creation.vbs +++ b/packages/default.gbdialog/sys-bot-farm-creation.vbs @@ -1,8 +1,7 @@ -' General Bots Copyright (c) Pragmatismo.io. All rights reserved. -' Licensed under the AGPL-3.0. +' General Bots Copyright (c) Pragmatismo.io. All rights reserved. Licensed under the AGPL-3.0. talk "Please, tell me what is the Bot name?" -hear name +hear title talk "If you tell me your username/password, I can show service subscription list to you." talk "What is your Username (eg.: human@domain.bot)" @@ -16,7 +15,8 @@ talk "Can you describe in a few words what the bot is about?" hear description talk "Please, choose what subscription would you like to connect to:" -hear one of subscriptions (email, password) into subscriptionId + +subscriptionId = "" talk "Please, provide the cloud location just like 'westus'?" hear cloudLocation @@ -26,6 +26,7 @@ hear nlpKey talk "Sorry, this part cannot be automated yet due to Microsoft schedule, please go to https://apps.dev.microsoft.com/portal/register-app to generate manually an App ID and App Secret." wait 1 + talk "Please, provide the App ID you just generated:" hear appId @@ -33,4 +34,5 @@ talk "Please, provide the Generated Password:" hear appPassword talk "Now, I am going to create a Bot farm... Wait 5 minutes or more..." -create bot farm (name, username, password, description, cloudLocation, nlpKey, appId, appPassword, subscriptionId) + +create a bot farm using title, username, password, description, cloudLocation, nlpKey, appId, appPassword, subscriptionId diff --git a/packages/security.gblib/services/SecService.ts b/packages/security.gblib/services/SecService.ts index c4d7d675..277b0081 100644 --- a/packages/security.gblib/services/SecService.ts +++ b/packages/security.gblib/services/SecService.ts @@ -36,7 +36,6 @@ const _ = require('lodash'); const Parse = require('csv-parse'); const Async = require('async'); const UrlJoin = require('url-join'); -const Walk = require('fs-walk'); const logger = require('../../../src/logger'); import { GBService, GBServiceCallback, IGBInstance } from 'botlib'; diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 97d806bf..5203524e 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -36,7 +36,6 @@ const _ = require('lodash'); const Parse = require('csv-parse'); const Async = require('async'); const UrlJoin = require('url-join'); -const Walk = require('fs-walk'); const logger = require('../../../src/logger'); const Swagger = require('swagger-client'); const rp = require('request-promise'); diff --git a/src/app.ts b/src/app.ts index 54ef2b30..50474bdc 100644 --- a/src/app.ts +++ b/src/app.ts @@ -51,6 +51,7 @@ 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 { GBVMService } from '../packages/core.gbapp/services/GBVMService'; +import { load } from 'dotenv'; const appPackages = new Array(); @@ -163,6 +164,9 @@ export class GBServer { } } +let service:GBVMService = new GBVMService (); +service.loadDialogPackage('C:\\Sources\\opensource\\BotServer\\packages\\default.gbdialog',null,null,null); + // First line to run. -GBServer.run(); +// GBServer.run(); From fecbd3e92c6aa56542712342b9ecac8476edde79 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 25 Feb 2019 08:36:43 -0300 Subject: [PATCH 12/32] fix(VBA): Several bugs fixed and refactoring on Deployer Service done. --- .gitignore | 3 + .../dialogs/StartDialog.ts | 227 ++++++ .../services/AzureDeployerService.ts | 685 ++++++------------ packages/core.gbapp/services/GBAPIService.ts | 34 +- packages/core.gbapp/services/GBCoreService.ts | 26 +- packages/core.gbapp/services/GBMinService.ts | 100 +-- packages/core.gbapp/services/GBVMService.ts | 8 +- .../sys-bot-farm-creation.vbs | 19 +- src/app.ts | 14 +- tslint.json | 1 + 10 files changed, 549 insertions(+), 568 deletions(-) create mode 100644 packages/azuredeployer.gbapp/dialogs/StartDialog.ts diff --git a/.gitignore b/.gitignore index e9430015..c6442887 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ /work /packages/default.gbdialog/bot.js /packages/default.gbdialog/bot.ts +*.vbs.compiled +*.vbs.js +*.vbs.ts diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts new file mode 100644 index 00000000..9ec814c9 --- /dev/null +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -0,0 +1,227 @@ +/*****************************************************************************\ +| ( )_ _ | +| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | +| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | +| | | ( )_) | | +| (_) \___/' | +| | +| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | +| Licensed under the AGPL-3.0. | +| | +| According to our dual licensing model, this program can be used either | +| under the terms of the GNU Affero General Public License, version 3, | +| or under a proprietary license. | +| | +| The texts of the GNU Affero General Public License with an additional | +| permission and of our proprietary license can be found at and | +| in the LICENSE file you have received along with this program. | +| | +| This program is distributed in the hope that it will be useful, | +| but WITHOUT ANY WARRANTY, without even the implied warranty of | +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +| GNU Affero General Public License for more details. | +| | +| "General Bots" is a registered trademark of Pragmatismo.io. | +| The licensing of the program under the AGPLv3 does not imply a | +| trademark license. Therefore any rights, title and interest in | +| our trademarks remain entirely with us. | +| | +\*****************************************************************************/ + +/** + * @fileoverview General Bots server core. + */ + +'use strict'; + +import { IGBInstance } from 'botlib'; +import * as fs from 'fs'; +import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; +import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService'; +import { AzureDeployerService } from '../services/AzureDeployerService'; +import { GuaribasInstance } from '../../../packages/core.gbapp/models/GBModel'; +const scanf = require('scanf'); + +/** + * Handles command-line dialog for getting info for Boot Bot. + */ +export class StartDialog { + + public static async createBaseInstance() { + + // No .env so asks for cloud credentials to start a new farm. + + if (!fs.existsSync(`.env`)) { + process.stdout.write( + 'A empty enviroment is detected. To start automatic deploy, please enter some information:\n' + ); + } + + let botId: string; + while (botId === undefined) { + botId = this.retrieveBotId(); + } + + let username: string; + while (username === undefined) { + username = this.retrieveUsername(); + } + + let password: string; + while (password === undefined) { + password = this.retrievePassword(); + } + + // Connects to the cloud and retrieves subscriptions. + + const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); + const list = await AzureDeployerService.getSubscriptions(credentials); + + let subscriptionId: string; + while (subscriptionId === undefined) { + subscriptionId = this.retrieveSubscriptionId(list); + } + + let location: string; + while (location === undefined) { + location = this.retrieveLocation(); + } + + let appId: string; + while (appId === undefined) { + appId = this.retrieveAppId(); + } + + let appPassword: string; + while (appPassword === undefined) { + appPassword = this.retrieveAppPassword(); + } + + let authoringKey: string; + while (authoringKey === undefined) { + authoringKey = this.retrieveAuthoringKey(); + } + + // Prepares the first instance on bot farm. + const instance = new GuaribasInstance(); + + instance.botId = botId; + instance.cloudUsername = username; + instance.cloudPassword = password; + instance.cloudSubscriptionId = subscriptionId; + instance.cloudLocation = location; + instance.nlpAuthoringKey = authoringKey; + instance.marketplaceId = appId; + instance.marketplacePassword = appPassword; + instance.adminPass = GBAdminService.getRndPassword(); + + return {instance, credentials, subscriptionId}; + } + + private static retrieveUsername() { + let value = GBConfigService.get('CLOUD_USERNAME'); + if (!value) { + process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_USERNAME:`); + value = scanf('%s').replace(/(\n|\r)+$/, ''); + } + + return value; + } + + private static retrievePassword() { + let password = GBConfigService.get('CLOUD_PASSWORD'); + if (!password) { + process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`); + password = scanf('%s').replace(/(\n|\r)+$/, ''); + } + return password; + } + + private static retrieveBotId() { + let botId = GBConfigService.get('BOT_ID'); + if (!botId) { + process.stdout.write( + `${GBAdminService.GB_PROMPT}Choose a unique bot Id containing lowercase letters, digits or +dashes (cannot use dash as the first two or last one characters), +cannot start or end with or contain consecutive dashes and having 4 to 42 characters long.\n` + ); + process.stdout.write(`${GBAdminService.GB_PROMPT}BOT_ID:`); + + // TODO: Update this regexp to match description of it. + + botId = scanf('%s').replace(/(\n|\r)+$/, ''); + } + + return botId; + } + + private static retrieveAuthoringKey() { + let authoringKey = GBConfigService.get('NLP_AUTHORING_KEY'); + if (!authoringKey) { + process.stdout.write( + `${ + GBAdminService.GB_PROMPT + }Due to this opened issue: https://github.com/Microsoft/botbuilder-tools/issues/550\n` + ); + process.stdout.write(`${GBAdminService.GB_PROMPT}Please enter your LUIS Authoring Key:`); + authoringKey = scanf('%s').replace(/(\n|\r)+$/, ''); + } + + return authoringKey; + } + + private static retrieveAppId() { + let appId = GBConfigService.get('MARKETPLACE_ID'); + process.stdout.write( + `Sorry, this part cannot be automated yet due to Microsoft schedule, +please go to https://apps.dev.microsoft.com/portal/register-app to +generate manually an App ID and App Secret.\n` + ); + if (!appId) { + process.stdout.write('Generated Application Id (MARKETPLACE_ID):'); + appId = scanf('%s').replace(/(\n|\r)+$/, ''); + } + + return appId; + } + + private static retrieveAppPassword() { + let appPassword = GBConfigService.get('MARKETPLACE_SECRET'); + if (!appPassword) { + process.stdout.write('Generated Password (MARKETPLACE_SECRET):'); + appPassword = scanf('%s').replace(/(\n|\r)+$/, ''); + } + + return appPassword; + } + + private static retrieveSubscriptionId(list) { + let subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); + const map = {}; + let index = 1; + list.forEach(element => { + console.log(`${index}: ${element.displayName} (${element.subscriptionId})`); + map[index++] = element; + }); + let subscriptionIndex; + if (!subscriptionIndex) { + process.stdout.write('CLOUD_SUBSCRIPTIONID (type a number):'); + subscriptionIndex = scanf('%d'); + subscriptionId = map[subscriptionIndex].subscriptionId; + } + + return subscriptionId; + } + + private static retrieveLocation() { + let location = GBConfigService.get('CLOUD_LOCATION'); + if (!location) { + process.stdout.write("CLOUD_LOCATION (eg. 'westus'):"); + location = scanf('%s'); + } + + return location; + } +} diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 8d47ca97..8e237aab 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -38,40 +38,38 @@ import { CognitiveServicesManagementClient } from 'azure-arm-cognitiveservices'; import { CognitiveServicesAccount } from 'azure-arm-cognitiveservices/lib/models'; -import { - ResourceManagementClient, - SubscriptionClient -} from 'azure-arm-resource'; +import { ResourceManagementClient, SubscriptionClient } from 'azure-arm-resource'; import { SearchManagementClient } from 'azure-arm-search'; import { SqlManagementClient } from 'azure-arm-sql'; import { WebSiteManagementClient } from 'azure-arm-website'; import { AppServicePlan } from 'azure-arm-website/lib/models'; import { GBService, IGBInstance } from 'botlib'; import { HttpMethods, ServiceClient, WebResource } from 'ms-rest-js'; -import { GBDeployer } from 'packages/core.gbapp/services/GBDeployer'; +import { GBDeployer } from '../../../packages/core.gbapp/services/GBDeployer'; import * as simplegit from 'simple-git/promise'; import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; import { GBCorePackage } from '../../../packages/core.gbapp'; import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService'; +import { GuaribasInstance } from '../../../packages/core.gbapp/models/GBModel'; const Spinner = require('cli-spinner').Spinner; const scanf = require('scanf'); const git = simplegit(); const logger = require('../../../src/logger'); const UrlJoin = require('url-join'); -const iconUrl = - 'https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-logo-squared.png'; +const iconUrl = 'https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-logo-squared.png'; const publicIp = require('public-ip'); export class AzureDeployerService extends GBService { public static apiVersion = '2017-12-01'; + public static defaultEndPoint = 'http://localhost:4242'; public instance: IGBInstance; public resourceClient: ResourceManagementClient.ResourceManagementClient; public webSiteClient: WebSiteManagementClient; public storageClient: SqlManagementClient; public cognitiveClient: CognitiveServicesManagementClient; public searchClient: SearchManagementClient; - public provider = 'Microsoft.BotService'; + public static provider = 'Microsoft.BotService'; public subscriptionClient: SubscriptionClient.SubscriptionClient; public accessToken: string; public location: string; @@ -189,228 +187,7 @@ export class AzureDeployerService extends GBService { }; } - public async deployFarm(proxyAddress: string): Promise { - const culture = 'en-us'; - - // Tries do get information from .env file otherwise asks in command-line. - - let instance: IGBInstance = {}; - instance = await this.ensureConfiguration(instance); - instance.marketplacePassword = GBAdminService.getRndPassword(); - - const spinner = new Spinner('%s'); - spinner.start(); - spinner.setSpinnerString('|/-\\'); - - let keys: any; - const name = instance.botId; - - logger.info(`Deploying Deploy Group (It may take a few minutes)...`); - await this.createDeployGroup(name, instance.cloudLocation); - - logger.info(`Deploying Bot Server...`); - const serverFarm = await this.createHostingPlan( - name, - `${name}-server-plan`, - instance.cloudLocation - ); - await this.createServer( - serverFarm.id, - name, - `${name}-server`, - instance.cloudLocation - ); - - logger.info(`Deploying Bot Storage...`); - const administratorLogin = `sa${GBAdminService.getRndReadableIdentifier()}`; - const administratorPassword = GBAdminService.getRndPassword(); - const storageServer = `${name.toLowerCase()}-storage-server`; - const storageName = `${name}-storage`; - await this.createStorageServer( - name, - storageServer, - administratorLogin, - administratorPassword, - storageServer, - instance.cloudLocation - ); - await this.createStorage( - name, - storageServer, - storageName, - instance.cloudLocation - ); - instance.storageUsername = administratorLogin; - instance.storagePassword = administratorPassword; - instance.storageName = storageName; - instance.storageDialect = 'mssql'; - instance.storageServer = storageServer; - - logger.info(`Deploying Search...`); - const searchName = `${name}-search`.toLowerCase(); - await this.createSearch(name, searchName, instance.cloudLocation); - const searchKeys = await this.searchClient.adminKeys.get( - name, - searchName - ); - instance.searchHost = `${searchName}.search.windows.net`; - instance.searchIndex = 'azuresql-index'; - instance.searchIndexer = 'azuresql-indexer'; - instance.searchKey = searchKeys.primaryKey; - this.deployer.rebuildIndex(instance); - - logger.info(`Deploying Speech...`); - const speech = await this.createSpeech( - name, - `${name}-speech`, - instance.cloudLocation - ); - keys = await this.cognitiveClient.accounts.listKeys(name, speech.name); - instance.speechKeyEndpoint = speech.endpoint; - instance.speechKey = keys.key1; - - logger.info(`Deploying SpellChecker...`); - const spellChecker = await this.createSpellChecker( - name, - `${name}-spellchecker`, - instance.cloudLocation - ); - keys = await this.cognitiveClient.accounts.listKeys( - name, - spellChecker.name - ); - instance.spellCheckerKey = keys.key1; - instance.spellCheckerEndpoint = spellChecker.endpoint; - - logger.info(`Deploying Text Analytics...`); - const textAnalytics = await this.createTextAnalytics( - name, - `${name}-textanalytics`, - instance.cloudLocation - ); - keys = await this.cognitiveClient.accounts.listKeys( - name, - textAnalytics.name - ); - instance.textAnalyticsEndpoint = textAnalytics.endpoint; - instance.textAnalyticsKey = keys.key1; - - logger.info(`Deploying NLP...`); - const nlp = await this.createNLP(name, `${name}-nlp`, instance.cloudLocation); - keys = await this.cognitiveClient.accounts.listKeys(name, nlp.name); - const nlpAppId = await this.createLUISApp( - name, - name, - instance.cloudLocation, - culture, - instance.nlpAuthoringKey - ); - - instance.nlpEndpoint = nlp.endpoint; - instance.nlpKey = keys.key1; - instance.nlpAppId = nlpAppId; - - logger.info(`Deploying Bot...`); - - // TODO: Default endpoint, will be updated when it runs in production. - - instance.botEndpoint = 'http://localhost:4242'; - - instance = await this.deployBootBot( - instance, - name, - `${proxyAddress}/api/messages/${name}`, - instance.nlpAppId, - instance.nlpKey, - instance.cloudSubscriptionId - ); - - spinner.stop(); - return instance; - } - - public async openStorageFirewall(groupName, serverName) { - const username = GBConfigService.get('CLOUD_USERNAME'); - const password = GBConfigService.get('CLOUD_PASSWORD'); - const subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); - - const credentials = await GBAdminService.getADALCredentialsFromUsername( - username, - password - ); - const storageClient = new SqlManagementClient(credentials, subscriptionId); - - const ip = await publicIp.v4(); - const params = { - startIpAddress: ip, - endIpAddress: ip - }; - - await storageClient.firewallRules.createOrUpdate( - groupName, - serverName, - 'gb', - params - ); - } - - public async deployBootBot( - instance, - botId, - endpoint, - nlpAppId, - nlpKey, - subscriptionId - ) { - let appId = GBConfigService.get('MARKETPLACE_ID'); - let appPassword = GBConfigService.get('MARKETPLACE_SECRET'); - - if (!appId || !appPassword) { - process.stdout.write( - 'Sorry, this part cannot be automated yet due to Microsoft schedule, please go to https://apps.dev.microsoft.com/portal/register-app to generate manually an App ID and App Secret.\n' - ); - } - - const retriveAppId = () => { - if (!appId) { - process.stdout.write('Generated Application Id (MARKETPLACE_ID):'); - appId = scanf('%s').replace(/(\n|\r)+$/, ''); - } - }; - - const retriveAppPassword = () => { - if (!appPassword) { - process.stdout.write('Generated Password (MARKETPLACE_SECRET):'); - appPassword = scanf('%s').replace(/(\n|\r)+$/, ''); - } - }; - - retriveAppId(); - retriveAppPassword(); - - await this.internalDeployBot( - instance, - this.accessToken, - botId, - botId, - botId, - 'General BootBot', - endpoint, - 'global', - nlpAppId, - nlpKey, - appId, - appPassword, - subscriptionId - ); - instance.marketplaceId = appId; - instance.marketplacePassword = appPassword; - instance.botId = botId; - - return instance; - } - - public async updateBotProxy(botId, group, endpoint) { + public static async updateBotProxy(botId, group, endpoint) { const baseUrl = `https://management.azure.com/`; const username = GBConfigService.get('CLOUD_USERNAME'); const password = GBConfigService.get('CLOUD_PASSWORD'); @@ -445,144 +222,193 @@ export class AzureDeployerService extends GBService { logger.info(`Bot proxy updated at: ${endpoint}.`); } - public async deployGeneralBotsToAzure() { - const status = await git.status(); - // TODO: Copy github to webapp. + public static async openStorageFirewall(groupName, serverName) { + const username = GBConfigService.get('CLOUD_USERNAME'); + const password = GBConfigService.get('CLOUD_PASSWORD'); + const subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); + + const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); + const storageClient = new SqlManagementClient(credentials, subscriptionId); + + const ip = await publicIp.v4(); + const params = { + startIpAddress: ip, + endIpAddress: ip + }; + + await storageClient.firewallRules.createOrUpdate(groupName, serverName, 'gb', params); } - private async ensureConfiguration(instance: IGBInstance) { - let username = GBConfigService.get('CLOUD_USERNAME'); - let password = GBConfigService.get('CLOUD_PASSWORD'); - let subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); - let location = GBConfigService.get('CLOUD_LOCATION'); - let botId = GBConfigService.get('BOT_ID'); + public static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) { + const req = new WebResource(); + req.method = verb; + req.url = url; + req.headers = {}; + req.headers['Content-Type'] = 'application/json'; + req.headers['accept-language'] = '*'; + req.headers.Authorization = 'Bearer ' + accessToken; + req.body = body; - // No .env so asks for cloud credentials to start a new farm. - if (!username || !password || !subscriptionId || !location || !botId) { - process.stdout.write( - 'A empty enviroment is detected. To start automatic deploy, please enter some information:\n' - ); - } - const retriveUsername = () => { - if (!username) { - process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_USERNAME:`); - username = scanf('%s').replace(/(\n|\r)+$/, ''); - } - }; - const retrivePassword = () => { - if (!password) { - process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`); - password = scanf('%s').replace(/(\n|\r)+$/, ''); - } - }; - const retrieveBotId = () => { - if (!botId) { - process.stdout.write( - `${GBAdminService.GB_PROMPT}Choose a unique bot Id containing lowercase letters, digits or dashes (cannot use dash as the first two or last one characters), cannot start or end with or contain consecutive dashes and having 4 to 42 characters long.\n` - ); - process.stdout.write(`${GBAdminService.GB_PROMPT}BOT_ID:`); - botId = scanf('%s').replace(/(\n|\r)+$/, ''); // TODO: Update this regexp to match description of it. - } - }; - let authoringKey = GBConfigService.get('NLP_AUTHORING_KEY'); - const retriveAuthoringKey = () => { - if (!authoringKey) { - process.stdout.write( - `${GBAdminService.GB_PROMPT}Due to this opened issue: https://github.com/Microsoft/botbuilder-tools/issues/550\n` - ); - process.stdout.write(`${GBAdminService.GB_PROMPT}Please enter your LUIS Authoring Key:`); - authoringKey = scanf('%s').replace(/(\n|\r)+$/, ''); - } - }; - while (!authoringKey) { - retriveAuthoringKey(); - } - while (!botId) { - retrieveBotId(); - } - while (!username) { - retriveUsername(); - } - while (!password) { - retrivePassword(); - } + return req; + } - // Connects to the cloud and retrives subscriptions. + public async deployFarm( + proxyAddress: string, + instance: IGBInstance, + credentials, + subscriptionId: string + ): Promise { + const culture = 'en-us'; - const credentials = await GBAdminService.getADALCredentialsFromUsername( - username, - password + this.initServices(credentials, subscriptionId); + + const spinner = new Spinner('%s'); + spinner.start(); + spinner.setSpinnerString('|/-\\'); + + let keys: any; + const name = instance.botId; + + logger.info(`Deploying Deploy Group (It may take a few minutes)...`); + await this.createDeployGroup(name, instance.cloudLocation); + + logger.info(`Deploying Bot Server...`); + const serverFarm = await this.createHostingPlan(name, `${name}-server-plan`, instance.cloudLocation); + await this.createServer(serverFarm.id, name, `${name}-server`, instance.cloudLocation); + + logger.info(`Deploying Bot Storage...`); + const administratorLogin = `sa${GBAdminService.getRndReadableIdentifier()}`; + const administratorPassword = GBAdminService.getRndPassword(); + const storageServer = `${name.toLowerCase()}-storage-server`; + const storageName = `${name}-storage`; + await this.createStorageServer( + name, + storageServer, + administratorLogin, + administratorPassword, + storageServer, + instance.cloudLocation ); - if (!subscriptionId) { - const map = {}; - let index = 1; - const list = await AzureDeployerService.getSubscriptions(credentials); - list.forEach(element => { - console.log( - `${index}: ${element.displayName} (${element.subscriptionId})` - ); - map[index++] = element; - }); - let subscriptionIndex; - const retrieveSubscription = () => { - if (!subscriptionIndex) { - process.stdout.write('CLOUD_SUBSCRIPTIONID (type a number):'); - subscriptionIndex = scanf('%d'); - } - }; - while (!subscriptionIndex) { - retrieveSubscription(); - } - subscriptionId = map[subscriptionIndex].subscriptionId; - } - const retriveLocation = () => { - if (!location) { - process.stdout.write('CLOUD_LOCATION (eg. \'westus\'):'); - location = scanf('%s'); - } - }; - while (!location) { - retriveLocation(); - } + await this.createStorage(name, storageServer, storageName, instance.cloudLocation); + instance.storageUsername = administratorLogin; + instance.storagePassword = administratorPassword; + instance.storageName = storageName; + instance.storageDialect = 'mssql'; + instance.storageServer = storageServer; - // Prepares the first instance on bot farm. + logger.info(`Deploying Search...`); + const searchName = `${name}-search`.toLowerCase(); + await this.createSearch(name, searchName, instance.cloudLocation); + const searchKeys = await this.searchClient.adminKeys.get(name, searchName); + instance.searchHost = `${searchName}.search.windows.net`; + instance.searchIndex = 'azuresql-index'; + instance.searchIndexer = 'azuresql-indexer'; + instance.searchKey = searchKeys.primaryKey; + this.deployer.rebuildIndex(instance); - instance.botId = botId; - instance.cloudUsername = username; - instance.cloudPassword = password; - instance.cloudSubscriptionId = subscriptionId; - instance.cloudLocation = location; - instance.nlpAuthoringKey = authoringKey; - instance.adminPass = GBAdminService.getRndPassword(); + logger.info(`Deploying Speech...`); + const speech = await this.createSpeech(name, `${name}-speech`, instance.cloudLocation); + keys = await this.cognitiveClient.accounts.listKeys(name, speech.name); + instance.speechKeyEndpoint = speech.endpoint; + instance.speechKey = keys.key1; - this.resourceClient = new ResourceManagementClient.default( - credentials, - subscriptionId - ); - this.webSiteClient = new WebSiteManagementClient( - credentials, - subscriptionId - ); - this.storageClient = new SqlManagementClient(credentials, subscriptionId); - this.cognitiveClient = new CognitiveServicesManagementClient( - credentials, - subscriptionId + logger.info(`Deploying SpellChecker...`); + const spellChecker = await this.createSpellChecker(name, `${name}-spellchecker`, instance.cloudLocation); + keys = await this.cognitiveClient.accounts.listKeys(name, spellChecker.name); + instance.spellCheckerKey = keys.key1; + instance.spellCheckerEndpoint = spellChecker.endpoint; + + logger.info(`Deploying Text Analytics...`); + const textAnalytics = await this.createTextAnalytics(name, `${name}-textanalytics`, instance.cloudLocation); + keys = await this.cognitiveClient.accounts.listKeys(name, textAnalytics.name); + instance.textAnalyticsEndpoint = textAnalytics.endpoint; + instance.textAnalyticsKey = keys.key1; + + logger.info(`Deploying NLP...`); + const nlp = await this.createNLP(name, `${name}-nlp`, instance.cloudLocation); + keys = await this.cognitiveClient.accounts.listKeys(name, nlp.name); + const nlpAppId = await this.createNLPService(name, name, instance.cloudLocation, culture, instance.nlpAuthoringKey); + + instance.nlpEndpoint = nlp.endpoint; + instance.nlpKey = keys.key1; + instance.nlpAppId = nlpAppId; + + logger.info(`Deploying Bot...`); + instance.botEndpoint = AzureDeployerService.defaultEndPoint; + + instance = await this.internalDeployBot( + instance, + this.accessToken, + name, + name, + name, + 'General BootBot', + `${proxyAddress}/api/messages/${name}`, + 'global', + instance.nlpAppId, + instance.nlpKey, + instance.appId, + instance.appPassword, + instance.cloudSubscriptionId ); - this.searchClient = new SearchManagementClient(credentials, subscriptionId); - this.accessToken = credentials.tokenCache._entries[0].accessToken; - + spinner.stop(); return instance; } - private async createStorageServer( - group, - name, - administratorLogin, - administratorPassword, - serverName, - location + public async deployToCloud( + title, + username, + password, + cloudLocation, + authoringKey, + appId, + appPassword, + subscriptionId ) { + + const instance = new GuaribasInstance(); + + instance.botId = title; + instance.cloudUsername = username; + instance.cloudPassword = password; + instance.cloudSubscriptionId = subscriptionId; + instance.cloudLocation = cloudLocation; + instance.nlpAuthoringKey = authoringKey; + instance.marketplaceId = appId; + instance.marketplacePassword = appPassword; + instance.adminPass = GBAdminService.getRndPassword(); + + const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); + this.deployFarm(`http://${instance.botId}.azurewebsites.net`, instance, credentials, subscriptionId); + + // TODO: Copy github to webapp. + //const status = await git.status(); + } + + private initServices(credentials: any, subscriptionId: string) { + this.resourceClient = new ResourceManagementClient.default(credentials, subscriptionId); + this.webSiteClient = new WebSiteManagementClient(credentials, subscriptionId); + this.storageClient = new SqlManagementClient(credentials, subscriptionId); + this.cognitiveClient = new CognitiveServicesManagementClient(credentials, subscriptionId); + this.searchClient = new SearchManagementClient(credentials, subscriptionId); + this.accessToken = credentials.tokenCache._entries[0].accessToken; + } + + private async updateWebisteConfig(group, serverFarmId, name, location) { + const siteConfig = { + location: location, + serverFarmId: serverFarmId, + numberOfWorkers: 1, + phpVersion: '5.5' + }; + + // TODO: Copy .env to app settings. + + return this.webSiteClient.webApps.createOrUpdateConfiguration(group, name, siteConfig); + } + + private async createStorageServer(group, name, administratorLogin, administratorPassword, serverName, location) { const params = { location: location, administratorLogin: administratorLogin, @@ -595,7 +421,7 @@ export class AzureDeployerService extends GBService { private async registerProviders(subscriptionId, baseUrl, accessToken) { const query = `subscriptions/${subscriptionId}/providers/${ - this.provider + AzureDeployerService.provider }/register?api-version=2018-02-01`; const requestUrl = UrlJoin(baseUrl, query); @@ -611,6 +437,7 @@ export class AzureDeployerService extends GBService { const res = await httpClient.sendRequest(req); // TODO: Check res for error. } + /** * @see https://github.com/Azure/azure-rest-api-specs/blob/master/specification/botservice/resource-manager/Microsoft.BotService/preview/2017-12-01/botservice.json */ @@ -660,18 +487,14 @@ export class AzureDeployerService extends GBService { const httpClient = new ServiceClient(); let query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ - this.provider + AzureDeployerService.provider }/botServices/${botId}?api-version=${AzureDeployerService.apiVersion}`; let url = UrlJoin(baseUrl, query); - let req = this.createRequestObject( - url, - accessToken, - 'PUT', - JSON.stringify(parameters) - ); + let req = AzureDeployerService.createRequestObject(url, accessToken, 'PUT', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); if (!(res.bodyAsJson as any).id) { reject(res.bodyAsText); + return; } @@ -681,42 +504,19 @@ export class AzureDeployerService extends GBService { AzureDeployerService.apiVersion }`; url = UrlJoin(baseUrl, query); - req = this.createRequestObject( - url, - accessToken, - 'GET', - JSON.stringify(parameters) - ); + req = AzureDeployerService.createRequestObject(url, accessToken, 'GET', JSON.stringify(parameters)); const resChannel = await httpClient.sendRequest(req); - const key = (resChannel.bodyAsJson as any).properties.properties - .sites[0].key; + const key = (resChannel.bodyAsJson as any).properties.properties.sites[0].key; instance.webchatKey = key; resolve(instance); } catch (error) { reject(error); } - }, 20000); + }, 20000); }); } - private createRequestObject( - url: string, - accessToken: string, - verb: HttpMethods, - body: string - ) { - const req = new WebResource(); - req.method = verb; - req.url = url; - req.headers = {}; - req.headers['Content-Type'] = 'application/json'; - req.headers['accept-language'] = '*'; - req.headers.Authorization = 'Bearer ' + accessToken; - req.body = body; - return req; - } - - private async createLUISApp( + private async createNLPService( name: string, description: string, location: string, @@ -730,23 +530,11 @@ export class AzureDeployerService extends GBService { }; const body = JSON.stringify(parameters); - const apps = await this.makeNlpRequest( - location, - authoringKey, - null, - 'GET', - 'apps' - ); + const apps = await this.makeNlpRequest(location, authoringKey, null, 'GET', 'apps'); const app = (apps.bodyAsJson as any).filter(x => x.name == name)[0]; let id: string; if (!app) { - const res = await this.makeNlpRequest( - location, - authoringKey, - body, - 'POST', - 'apps' - ); + const res = await this.makeNlpRequest(location, authoringKey, body, 'POST', 'apps'); id = res.bodyAsText; } else { id = app.id; @@ -771,8 +559,8 @@ export class AzureDeployerService extends GBService { req.headers['Ocp-Apim-Subscription-Key'] = authoringKey; req.body = body; const httpClient = new ServiceClient(); - const res = await httpClient.sendRequest(req); - return res; + + return await httpClient.sendRequest(req); } private async createSearch(group, name, location) { @@ -791,20 +579,10 @@ export class AzureDeployerService extends GBService { location: location }; - return this.storageClient.databases.createOrUpdate( - group, - serverName, - name, - params - ); + return this.storageClient.databases.createOrUpdate(group, serverName, name, params); } - private async createCognitiveServices( - group, - name, - location, - kind - ): Promise { + private async createCognitiveServices(group, name, location, kind): Promise { const params = { sku: { name: 'F0' }, createMode: 'Default', @@ -816,51 +594,20 @@ export class AzureDeployerService extends GBService { return await this.cognitiveClient.accounts.create(group, name, params); } - private async createSpeech( - group, - name, - location - ): Promise { - return await this.createCognitiveServices( - group, - name, - location, - 'SpeechServices' - ); + private async createSpeech(group, name, location): Promise { + return await this.createCognitiveServices(group, name, location, 'SpeechServices'); } - private async createNLP( - group, - name, - location - ): Promise { + private async createNLP(group, name, location): Promise { return await this.createCognitiveServices(group, name, location, 'LUIS'); } - private async createSpellChecker( - group, - name, - location - ): Promise { - return await this.createCognitiveServices( - group, - name, - 'global', - 'Bing.SpellCheck.v7' - ); + private async createSpellChecker(group, name, location): Promise { + return await this.createCognitiveServices(group, name, 'global', 'Bing.SpellCheck.v7'); } - private async createTextAnalytics( - group, - name, - location - ): Promise { - return await this.createCognitiveServices( - group, - name, - location, - 'TextAnalytics' - ); + private async createTextAnalytics(group, name, location): Promise { + return await this.createCognitiveServices(group, name, location, 'TextAnalytics'); } private async createDeployGroup(name, location) { @@ -868,11 +615,7 @@ export class AzureDeployerService extends GBService { return this.resourceClient.resourceGroups.createOrUpdate(name, params); } - private async createHostingPlan( - group, - name, - location - ): Promise { + private async createHostingPlan(group, name, location): Promise { const params = { serverFarmWithRichSkuName: name, location: location, @@ -883,11 +626,7 @@ export class AzureDeployerService extends GBService { } }; - return this.webSiteClient.appServicePlans.createOrUpdate( - group, - name, - params - ); + return this.webSiteClient.appServicePlans.createOrUpdate(group, name, params); } private async createServer(farmId, group, name, location) { @@ -897,21 +636,5 @@ export class AzureDeployerService extends GBService { }; return this.webSiteClient.webApps.createOrUpdate(group, name, parameters); } - - private async updateWebisteConfig(group, serverFarmId, name, location) { - const siteConfig = { - location: location, - serverFarmId: serverFarmId, - numberOfWorkers: 1, - phpVersion: '5.5' - }; - - // TODO: Copy .env to app settings. - - return this.webSiteClient.webApps.createOrUpdateConfiguration( - group, - name, - siteConfig - ); - } + } diff --git a/packages/core.gbapp/services/GBAPIService.ts b/packages/core.gbapp/services/GBAPIService.ts index d1a2e64f..23335bfc 100644 --- a/packages/core.gbapp/services/GBAPIService.ts +++ b/packages/core.gbapp/services/GBAPIService.ts @@ -36,8 +36,12 @@ import { TurnContext } from 'botbuilder'; import { WaterfallStepContext } from 'botbuilder-dialogs'; import { GBMinInstance } from 'botlib'; import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; -const WaitUntil = require('wait-until'); +import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; + +/** + * BASIC system class for extra manipulation of bot behaviour. + */ class SysClass { public min: GBMinInstance; @@ -45,20 +49,36 @@ class SysClass { this.min = min; } - public generatePassword(){ + public async wait(seconds: number) { + const timeout = ms => new Promise(resolve => setTimeout(resolve, ms)); + await timeout(seconds * 1000); + } + + public generatePassword() { return GBAdminService.getRndPassword(); } public async createABotFarmUsing( botId, - description, + username, + password, location, nlpAuthoringKey, appId, appPassword, subscriptionId ) { - + const service = new AzureDeployerService(this.min.deployer); + await service.deployToCloud( + botId, + username, + password, + location, + nlpAuthoringKey, + appId, + appPassword, + subscriptionId + ); } } /** @@ -66,6 +86,7 @@ class SysClass { */ export default class DialogClass { + public min: GBMinInstance; public context: TurnContext; public step: WaterfallStepContext; @@ -73,16 +94,17 @@ export default class DialogClass { constructor(min: GBMinInstance) { this.min = min; + this.internalSys = new SysClass(min); } - public async sys() { + public sys(): SysClass { return this.internalSys; } public async hear(cb) { const idCallback = Math.floor(Math.random() * 1000000000000); this.min.cbMap[idCallback] = cb; - await this.step.beginDialog('/hear', { id: idCallback}); + await this.step.beginDialog('/hear', { id: idCallback }); } public async talk(text: string) { diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index cdb036a4..bfd0ad62 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -50,7 +50,7 @@ import { GBSecurityPackage } from '../../security.gblib'; import { GBWhatsappPackage } from '../../whatsapp.gblib/index'; import { GuaribasInstance } from '../models/GBModel'; import { GBConfigService } from './GBConfigService'; -import { GBImporter } from './GBImporterService'; +import { StartDialog } from '../../azuredeployer.gbapp/dialogs/StartDialog'; const logger = require('../../../src/logger'); const opn = require('opn'); @@ -274,7 +274,7 @@ STORAGE_SYNC=true const instance = instances[0]; if (process.env.NODE_ENV === 'development') { logger.info(`Updating bot endpoint to local reverse proxy (ngrok)...`); - await azureDeployer.updateBotProxy( + await AzureDeployerService.updateBotProxy( instance.botId, instance.botId, `${proxyAddress}/api/messages/${instance.botId}` @@ -347,22 +347,22 @@ STORAGE_SYNC=true } public async createBootInstance(core: GBCoreService, azureDeployer: AzureDeployerService, proxyAddress: string) { - let instance: IGBInstance; logger.info(`Deploying cognitive infrastructure (on the cloud / on premises)...`); try { - instance = await azureDeployer.deployFarm(proxyAddress); + let { instance, credentials, subscriptionId } = await StartDialog.createBaseInstance(); + instance = await azureDeployer.deployFarm(proxyAddress, instance, credentials, subscriptionId); + core.writeEnv(instance); + logger.info(`File .env written, starting General Bots...`); + GBConfigService.init(); + + return instance; } catch (error) { logger.warn( - `In case of error, please cleanup any infrastructure objects + `In case of error, please cleanup any infrastructure objects created during this procedure and .env before running again.` ); throw error; } - core.writeEnv(instance); - logger.info(`File .env written, starting General Bots...`); - GBConfigService.init(); - - return instance; } public openBrowserInDevelopment() { @@ -407,7 +407,7 @@ STORAGE_SYNC=true const fkcols = args[0]; let fkname = table; let matches = re4.exec(fkcols); - while (matches != null) { + while (matches != undefined) { fkname += '_' + matches[1]; matches = re4.exec(fkcols); } @@ -440,7 +440,7 @@ STORAGE_SYNC=true const fkcols = args[2]; let fkname = table; let matches = re3.exec(fkcols); - while (matches != null) { + while (matches != undefined) { fkname += '_' + matches[1]; matches = re3.exec(fkcols); } @@ -459,6 +459,6 @@ STORAGE_SYNC=true private async openStorageFrontier(deployer: AzureDeployerService) { const group = GBConfigService.get('CLOUD_GROUP'); const serverName = GBConfigService.get('STORAGE_SERVER').split('.database.windows.net')[0]; - await deployer.openStorageFirewall(group, serverName); + await AzureDeployerService.openStorageFirewall(group, serverName); } } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 6191e1c8..bd4643e8 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -175,30 +175,42 @@ export class GBMinService { throw new Error(msg); } const authenticationContext = new AuthenticationContext( - UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant)); + UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant) + ); const resource = 'https://graph.microsoft.com'; authenticationContext.acquireTokenWithAuthorizationCode( - req.query.code, UrlJoin(instance.botEndpoint, min.instance.botId, '/token'), - resource, instance.authenticatorClientId, instance.authenticatorClientSecret, async (err, token) => { - if (err) { - const msg = `Error acquiring token: ${err}`; - logger.error(msg); - res.send(msg); - } else { - await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); - await this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); - await this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); - await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', null); - res.redirect(min.instance.botEndpoint); + req.query.code, + UrlJoin(instance.botEndpoint, min.instance.botId, '/token'), + resource, + instance.authenticatorClientId, + instance.authenticatorClientSecret, + async (err, token) => { + if (err) { + const msg = `Error acquiring token: ${err}`; + logger.error(msg); + res.send(msg); + } else { + await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); + await this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); + await this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); + await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', null); + res.redirect(min.instance.botEndpoint); + } } - }); + ); }); } private handleOAuthRequests(server: any, min: GBMinInstance) { - server.get(`/${min.instance.botId}/auth`, function (req, res) { - let authorizationUrl = UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant, '/oauth2/authorize'); - authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${min.instance.authenticatorClientId}&redirect_uri=${UrlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; + server.get(`/${min.instance.botId}/auth`, function(req, res) { + let authorizationUrl = UrlJoin( + min.instance.authenticatorAuthorityHostUrl, + min.instance.authenticatorTenant, + '/oauth2/authorize' + ); + authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${ + min.instance.authenticatorClientId + }&redirect_uri=${UrlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; res.redirect(authorizationUrl); }); } @@ -218,16 +230,18 @@ export class GBMinService { if (!theme) { theme = 'default.gbtheme'; } - res.send(JSON.stringify({ - instanceId: instance.instanceId, - botId: botId, - theme: theme, - secret: instance.webchatKey, - speechToken: speechToken, - conversationId: webchatToken.conversationId, - authenticatorTenant: instance.authenticatorTenant, - authenticatorClientId: instance.authenticatorClientId - })); + res.send( + JSON.stringify({ + instanceId: instance.instanceId, + botId: botId, + theme: theme, + secret: instance.webchatKey, + speechToken: speechToken, + conversationId: webchatToken.conversationId, + authenticatorTenant: instance.authenticatorTenant, + authenticatorClientId: instance.authenticatorClientId + }) + ); } else { const error = `Instance not found: ${botId}.`; res.sendStatus(error); @@ -308,6 +322,7 @@ export class GBMinService { min.adminService = this.adminService; min.instance = await this.core.loadInstance(min.botId); min.cbMap = {}; + min.scriptMap = {}; min.userProfile = conversationState.createProperty('userProfile'); const dialogState = conversationState.createProperty('dialogState'); @@ -339,12 +354,12 @@ export class GBMinService { p.channel.received(req, res); }); } - }, this); + }, this); appPackages.forEach(e => { e.sysPackages = sysPackages; e.loadBot(min); - }, this); + }, this); } /** @@ -359,9 +374,7 @@ export class GBMinService { instance: any, appPackages: any[] ) { - await adapter.processActivity(req, res, async context => { - // Get loaded user state const state = await conversationState.get(context); const step = await min.dialogs.createContext(context, state); @@ -439,15 +452,15 @@ export class GBMinService { await step.beginDialog('/faq'); } else if (context.activity.name === 'answerEvent') { await step.beginDialog('/answerEvent', { - questionId: (context.activity).data, + questionId: context.activity.data, fromFaq: true }); } else if (context.activity.name === 'quality') { await step.beginDialog('/quality', { - score: (context.activity).data + score: context.activity.data }); } else if (context.activity.name === 'updateToken') { - const token = (context.activity).data; + const token = context.activity.data; await step.beginDialog('/adminUpdateToken', { token: token }); } else { await step.continueDialog(); @@ -455,30 +468,28 @@ export class GBMinService { } private async processMessageActivity(context, min: GBMinInstance, step: any) { - // Direct script invoking by itent name. - let mainMethod = min.scriptMap[context.activity.text]; - if (mainMethod != undefined) { + let isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined; + + if (isVMCall) { + + let mainMethod = context.activity.text; + min.sandbox.context = context; min.sandbox.step = step; min.sandbox[mainMethod].bind(min.sandbox); await min.sandbox[mainMethod](); - - }else if (context.activity.text === 'admin') { - + } else if (context.activity.text === 'admin') { await step.beginDialog('/admin'); - // Checks for /menu JSON signature. + // Checks for /menu JSON signature. } else if (context.activity.text.startsWith('{"title"')) { - await step.beginDialog('/menu', { data: JSON.parse(context.activity.text) }); // Otherwise, continue to the active dialog in the stack. - } else { - const user = await min.userProfile.get(context, {}); if (step.activeDialog) { await step.continueDialog(); @@ -487,7 +498,6 @@ export class GBMinService { query: context.activity.text }); } - } } } diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index 3818f063..0f999824 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -37,8 +37,8 @@ import { GBMinInstance, IGBCoreService } from 'botlib'; import * as fs from 'fs'; import { GBDeployer } from './GBDeployer'; import { TSCompiler } from './TSCompiler'; -import GBAPIService from './GBAPIService'; import DialogClass from './GBAPIService'; + const walkPromise = require('walk-promise'); const logger = require('../../../src/logger'); const vm = require('vm'); @@ -59,7 +59,9 @@ export class GBVMService implements IGBCoreService { private readonly script = new vm.Script(); public async loadDialogPackage(folder: string, min: GBMinInstance, core: IGBCoreService, deployer: GBDeployer) { + const files = await walkPromise(folder); + this.addHearDialog(min); return Promise.all( files.map(async file => { @@ -70,14 +72,14 @@ export class GBVMService implements IGBCoreService { file.name.endsWith('.bas') ) { const mainName = file.name.replace(/\-|\./g, ''); - // min.scriptMap[file.name] = ; + min.scriptMap[file.name] = mainName; const filename = UrlJoin(folder, file.name); fs.watchFile(filename, async () => { await this.run(filename, min, deployer, mainName); }); + await this.run(filename, min, deployer, mainName); - this.addHearDialog(min); } }) ); diff --git a/packages/default.gbdialog/sys-bot-farm-creation.vbs b/packages/default.gbdialog/sys-bot-farm-creation.vbs index 7ab1d431..0dfbf474 100644 --- a/packages/default.gbdialog/sys-bot-farm-creation.vbs +++ b/packages/default.gbdialog/sys-bot-farm-creation.vbs @@ -7,25 +7,24 @@ talk "If you tell me your username/password, I can show service subscription lis talk "What is your Username (eg.: human@domain.bot)" hear email +talk "What is your Password" +hear password + talk "Your password? (Will be discarded after sigining process)" -talk "Let's generate a very dificult to guess password for the new bot:" -generate a password -talk "Your password is *" + password + "*. Keep it on a safe place only acessible to you." talk "Can you describe in a few words what the bot is about?" hear description -talk "Please, choose what subscription would you like to connect to:" - -subscriptionId = "" +talk "Please, paste the Subscription ID (Azure):" +hear subscriptionId talk "Please, provide the cloud location just like 'westus'?" -hear cloudLocation +hear location talk "Please, provide the Authoring Key for NLP service (LUIS)?" -hear nlpKey +hear authoringKey talk "Sorry, this part cannot be automated yet due to Microsoft schedule, please go to https://apps.dev.microsoft.com/portal/register-app to generate manually an App ID and App Secret." -wait 1 +wait 5 talk "Please, provide the App ID you just generated:" hear appId @@ -35,4 +34,4 @@ hear appPassword talk "Now, I am going to create a Bot farm... Wait 5 minutes or more..." -create a bot farm using title, username, password, description, cloudLocation, nlpKey, appId, appPassword, subscriptionId +create a bot farm using title, email, password, location, authoringKey, appId, appPassword, subscriptionId diff --git a/src/app.ts b/src/app.ts index 50474bdc..b598c88e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -103,9 +103,9 @@ export class GBServer { logger.info(`Establishing a development local proxy (ngrok)...`); const proxyAddress: string = await core.ensureProxy(port); - + // Creates a boot instance or load it frmo storage. - + let bootInstance: IGBInstance = null; try { await core.initStorage(); @@ -117,11 +117,10 @@ export class GBServer { // Deploys system and user packages. logger.info(`Deploying packages...`); - await core.loadSysPackages(core); + core.loadSysPackages(core); await core.checkStorage(azureDeployer); await deployer.deployPackages(core, server, appPackages); - // Loads all bot instances. logger.info(`Publishing instances...`); @@ -153,8 +152,6 @@ export class GBServer { core.openBrowserInDevelopment(); - return core; - } catch (err) { logger.error(`STOP: ${err} ${err.stack ? err.stack : ''}`); process.exit(1); @@ -164,9 +161,6 @@ export class GBServer { } } -let service:GBVMService = new GBVMService (); -service.loadDialogPackage('C:\\Sources\\opensource\\BotServer\\packages\\default.gbdialog',null,null,null); - // First line to run. -// GBServer.run(); +GBServer.run(); diff --git a/tslint.json b/tslint.json index b23d6bb2..3ed5212b 100644 --- a/tslint.json +++ b/tslint.json @@ -15,6 +15,7 @@ ], "jsRules": {}, "rules": { + "no-floating-promises": false, "no-var-requires":false, "typedef":false, "variable-name": false, From fd39b1d6dc10bd9cd00b35aa20c265ae47a19f62 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 25 Feb 2019 09:44:39 -0300 Subject: [PATCH 13/32] chore(VBA): Draft BASIC guide added. --- packages/azuredeployer.gbapp/dialogs/StartDialog.ts | 12 +++++++----- .../services/AzureDeployerService.ts | 3 +-- packages/core.gbapp/services/GBConfigService.ts | 6 ++++++ packages/core.gbapp/services/GBCoreService.ts | 4 ++-- src/app.ts | 3 ++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index 9c38dbf0..679f50fa 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -48,9 +48,7 @@ const scanf = require('scanf'); * Handles command-line dialog for getting info for Boot Bot. */ export class StartDialog { - public static async createBaseInstance() { - // No .env so asks for cloud credentials to start a new farm. if (!fs.existsSync(`.env`)) { @@ -105,7 +103,7 @@ export class StartDialog { } // Prepares the first instance on bot farm. - const instance = new GuaribasInstance(); + const instance: IGBInstance = {}; instance.botId = botId; instance.cloudUsername = username; @@ -117,7 +115,7 @@ export class StartDialog { instance.marketplacePassword = appPassword; instance.adminPass = GBAdminService.getRndPassword(); - return {instance, credentials, subscriptionId}; + return { instance, credentials, subscriptionId }; } private static retrieveUsername() { @@ -165,7 +163,11 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac GBAdminService.GB_PROMPT }Due to this opened issue: https://github.com/Microsoft/botbuilder-tools/issues/550\n` ); - process.stdout.write(`${GBAdminService.GB_PROMPT}Please enter your LUIS Authoring Key, get it here: https://www.luis.ai/user/settings and paste it to me:`); + process.stdout.write( + `${ + GBAdminService.GB_PROMPT + }Please enter your LUIS Authoring Key, get it here: https://www.luis.ai/user/settings and paste it to me:` + ); authoringKey = scanf('%s').replace(/(\n|\r)+$/, ''); } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 8e237aab..3ea78a42 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -367,7 +367,7 @@ export class AzureDeployerService extends GBService { subscriptionId ) { - const instance = new GuaribasInstance(); + const instance: IGBInstance = {}; instance.botId = title; instance.cloudUsername = username; @@ -494,7 +494,6 @@ export class AzureDeployerService extends GBService { const res = await httpClient.sendRequest(req); if (!(res.bodyAsJson as any).id) { reject(res.bodyAsText); - return; } diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index 60160e01..e6be5c2d 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -74,6 +74,12 @@ export class GBConfigService { case 'CLOUD_LOCATION': value = undefined; break; + case 'MARKETPLACE_ID': + value = undefined; + break; + case 'MARKETPLACE_SECRET': + value = undefined; + break; case 'NLP_AUTHORING_KEY': value = undefined; break; diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index bfd0ad62..8716a1d7 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -309,8 +309,8 @@ STORAGE_SYNC=true */ public async ensureInstances(instances: GuaribasInstance[], bootInstance: any, core: GBCoreService) { if (!instances) { - const saveInstance = new GuaribasInstance(bootInstance); - await saveInstance.save(); + const instance: IGBInstance = {}; + await instance.save(); instances = await core.loadInstances(); } diff --git a/src/app.ts b/src/app.ts index b598c88e..4fd8ec5d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -91,7 +91,6 @@ export class GBServer { GBConfigService.init(); const core = new GBCoreService(); - core.ensureAdminIsSecured(); const importer: GBImporter = new GBImporter(core); const deployer: GBDeployer = new GBDeployer(core, importer); @@ -114,6 +113,8 @@ export class GBServer { await core.initStorage(); } + core.ensureAdminIsSecured(); + // Deploys system and user packages. logger.info(`Deploying packages...`); From 6588049025c8711390b9a6f3fabea81c22aa30cc Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Thu, 28 Feb 2019 15:15:51 -0300 Subject: [PATCH 14/32] fix(NLP): Update of platform to mach NLP URL updates and versioning. --- package-lock.json | 484 ++++-------------- package.json | 40 +- .../dialogs/StartDialog.ts | 3 + .../services/GBConversationalService.ts | 6 +- packages/core.gbapp/services/GBCoreService.ts | 1 + packages/core.gbapp/services/GBMinService.ts | 15 +- packages/kb.gbapp/dialogs/AskDialog.ts | 2 + 7 files changed, 144 insertions(+), 407 deletions(-) diff --git a/package-lock.json b/package-lock.json index 806acdfa..9e5a51be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -981,14 +981,6 @@ } } }, - "@kyleshockey/js-yaml": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@kyleshockey/js-yaml/-/js-yaml-1.0.1.tgz", - "integrity": "sha512-coFyIk1LvTscq1cUU4nCCfYwv+cmG4fCP+wgDKgYZjhM4f++YwZy+g0k+1tUqa4GuUpBTEOGH2KUqKFFWdT73g==", - "requires": { - "argparse": "^1.0.7" - } - }, "@kyleshockey/object-assign-deep": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@kyleshockey/object-assign-deep/-/object-assign-deep-0.4.2.tgz", @@ -1523,25 +1515,11 @@ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" }, - "@types/async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@types/async/-/async-2.4.1.tgz", - "integrity": "sha512-C09BK/wXzbW+/JK9zckhe+FeSbg7NmvVjUWwApnw7ksRpUq3ecGLiq2Aw1LlY4Z/VmtdhSaIs7jO5/MWRYMcOA==" - }, "@types/bluebird": { "version": "3.5.18", "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.18.tgz", "integrity": "sha512-OTPWHmsyW18BhrnG5x8F7PzeZ2nFxmHGb42bZn79P9hl+GI5cMzyPgQTwNjbem0lJhoru/8vtjAFCUOu3+gE2w==" }, - "@types/body-parser": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz", - "integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==", - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, "@types/caseless": { "version": "0.12.1", "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.1.tgz", @@ -1553,14 +1531,6 @@ "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", "dev": true }, - "@types/connect": { - "version": "3.4.32", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz", - "integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==", - "requires": { - "@types/node": "*" - } - }, "@types/continuation-local-storage": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/@types/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz", @@ -1582,25 +1552,6 @@ "resolved": "http://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==" }, - "@types/express": { - "version": "4.16.1", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.16.1.tgz", - "integrity": "sha512-V0clmJow23WeyblmACoxbHBu2JKlE5TiIme6Lem14FnPW9gsttyHtk6wq7njcdIWH1njAaFgR8gW09lgY98gQg==", - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.16.1", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.1.tgz", - "integrity": "sha512-QgbIMRU1EVRry5cIu1ORCQP4flSYqLM1lS5LYyGWfKnFT3E58f0gKto7BR13clBFVrVZ0G0rbLZ1hUpSkgQQOA==", - "requires": { - "@types/node": "*", - "@types/range-parser": "*" - } - }, "@types/filenamify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/filenamify/-/filenamify-2.0.1.tgz", @@ -1678,11 +1629,6 @@ "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.4.2.tgz", "integrity": "sha512-cDB930/7MbzaGF6U3IwSQp6XBru8xWajF5PV2YZZeV8DyiliTuld11afVztGI9+yJZ29il5E+NpGA6ooV/Cjkg==" }, - "@types/mime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz", - "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==" - }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -1706,11 +1652,6 @@ "@types/node": "*" } }, - "@types/range-parser": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", - "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==" - }, "@types/request": { "version": "2.47.1", "resolved": "https://registry.npmjs.org/@types/request/-/request-2.47.1.tgz", @@ -1736,9 +1677,9 @@ "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==" }, "@types/sequelize": { - "version": "4.27.37", - "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.37.tgz", - "integrity": "sha512-o1bnbLaw/tPf0QsrLyXB1JwnMvK7gNR29bgCjNlk0fnYyHHk9M7jrnevqjM8tkd5uJVx5bRj09Bxm4ynrYyCkQ==", + "version": "4.27.38", + "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.38.tgz", + "integrity": "sha512-HR+epHzmU8xSMRUjhuuYKHn3IxD2Ft4OePEqXY8/6otDyPn9s6SZx4bVLnUa98jv6Ny0Di9IHQHOXh35O7QajQ==", "dev": true, "requires": { "@types/bluebird": "*", @@ -1747,15 +1688,6 @@ "@types/validator": "*" } }, - "@types/serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==", - "requires": { - "@types/express-serve-static-core": "*", - "@types/mime": "*" - } - }, "@types/shelljs": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.2.tgz", @@ -1765,11 +1697,6 @@ "@types/node": "*" } }, - "@types/sprintf-js": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@types/sprintf-js/-/sprintf-js-1.1.2.tgz", - "integrity": "sha512-hkgzYF+qnIl8uTO8rmUSVSfQ8BIfMXC4yJAF4n8BE758YsKBZvFC4NumnAegj7KmylP0liEZNpb9RRGFMbFejA==" - }, "@types/tough-cookie": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.3.tgz", @@ -2205,7 +2132,8 @@ "asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true }, "asn1": { "version": "0.2.4", @@ -2703,15 +2631,15 @@ } }, "botbuilder": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", - "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", + "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", "requires": { "@types/filenamify": "^2.0.1", "@types/node": "^9.3.0", "async-file": "^2.0.2", - "botbuilder-core": "^4.2.1", - "botframework-connector": "^4.2.1", + "botbuilder-core": "^4.1.7", + "botframework-connector": "^4.1.7", "filenamify": "^2.0.0", "rimraf": "^2.6.2" }, @@ -2724,16 +2652,16 @@ } }, "botbuilder-ai": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.1.tgz", - "integrity": "sha512-gej7KR0iFIK38M4eIkGFOn+Tk7sMpzGTJgMVy/ctz21m6vQDGfqFLjJzDk4GRG9oLaZfq5bqUw5sLtepLAZcUg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", + "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", "requires": { "@microsoft/recognizers-text-date-time": "1.1.2", "@types/html-entities": "^1.2.16", "@types/node": "^9.3.0", "@types/request-promise-native": "^1.0.10", "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "^4.2.1", + "botbuilder": "^4.2.0", "html-entities": "^1.2.1", "moment": "^2.20.1", "ms-rest": "^2.3.6", @@ -2747,6 +2675,20 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" }, + "botbuilder": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", + "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^9.3.0", + "async-file": "^2.0.2", + "botbuilder-core": "^4.2.1", + "botframework-connector": "^4.2.1", + "filenamify": "^2.0.0", + "rimraf": "^2.6.2" + } + }, "request-promise-native": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", @@ -2760,13 +2702,13 @@ } }, "botbuilder-azure": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.1.tgz", - "integrity": "sha512-YbdIF3Xp3m1Ei3EnPY3YyPPrH/u10pBplMTluPnc1Qptd1z5mRtuG02kLsG22SivQN7rhyA8WNSgHlAjXShpeg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", + "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", "requires": { "@types/node": "^9.3.0", "azure-storage": "^2.10.2", - "botbuilder": "^4.2.1", + "botbuilder": "^4.2.0", "documentdb": "1.14.5", "flat": "^4.0.0", "semaphore": "^1.1.0" @@ -2776,6 +2718,20 @@ "version": "9.6.42", "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + }, + "botbuilder": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", + "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^9.3.0", + "async-file": "^2.0.2", + "botbuilder-core": "^4.2.1", + "botframework-connector": "^4.2.1", + "filenamify": "^2.0.0", + "rimraf": "^2.6.2" + } } } }, @@ -2944,16 +2900,16 @@ } }, "botbuilder-dialogs": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.1.tgz", - "integrity": "sha512-QHD9WigzC7rOJT0hb9Xzs/yHs1g/MOabJey8qxlZPdnnQqK5X8KJaZEEDnRqcUmLj/ydbxnxqImLEsMD5zlGag==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", + "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", "requires": { "@microsoft/recognizers-text-choice": "1.1.2", "@microsoft/recognizers-text-date-time": "1.1.2", "@microsoft/recognizers-text-number": "1.1.2", "@microsoft/recognizers-text-suite": "1.1.2", "@types/node": "^9.3.0", - "botbuilder-core": "^4.2.1" + "botbuilder-core": "^4.2.0" }, "dependencies": { "@microsoft/recognizers-text-choice": { @@ -2997,124 +2953,6 @@ } } }, - "botbuilder-location": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/botbuilder-location/-/botbuilder-location-2.0.0.tgz", - "integrity": "sha1-EQnJAtB4Gtr8zYKsMtOxSSvCPGo=", - "requires": { - "botbuilder": "^3.5.3", - "request-promise": "^4.1.1", - "sprintf-js": "^1.0.3" - }, - "dependencies": { - "@types/jsonwebtoken": { - "version": "7.2.8", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz", - "integrity": "sha512-XENN3YzEB8D6TiUww0O8SRznzy1v+77lH7UmuN54xq/IHIsyWjWOzZuFFTtoiRuaE782uAoRwBe/wwow+vQXZw==", - "requires": { - "@types/node": "*" - } - }, - "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" - }, - "@types/url-join": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/@types/url-join/-/url-join-0.8.3.tgz", - "integrity": "sha512-bM7dzLHuCqDNlbeOxvo/KfweN3La4d9C1VFGCgefxiZXn0JcRtyGDwWCSUEO8RrMhnx/LGhDOXP8TTokM1grSA==" - }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" - }, - "base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" - }, - "botbuilder": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-3.16.0.tgz", - "integrity": "sha512-Gf51aNfvBuAxKSXQ+1SV/P1lzuRMyMyIqvjUUSqpjbtW6lFkPHhCmJIM0Dgxbflq78EXXisIYZQgAqsUNYeVQQ==", - "requires": { - "@types/async": "^2.0.48", - "@types/express": "^4.11.1", - "@types/form-data": "^2.2.1", - "@types/jsonwebtoken": "^7.2.6", - "@types/node": "^9.6.1", - "@types/request": "^2.47.0", - "@types/sprintf-js": "^1.1.0", - "@types/url-join": "^0.8.1", - "async": "^1.5.2", - "base64url": "^3.0.0", - "chrono-node": "^1.1.3", - "jsonwebtoken": "^8.2.2", - "promise": "^7.1.1", - "request": "^2.88.0", - "rsa-pem-from-mod-exp": "^0.8.4", - "sprintf-js": "^1.0.3", - "url-join": "^1.1.0" - } - }, - "ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "jsonwebtoken": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.0.tgz", - "integrity": "sha512-IqEycp0znWHNA11TpYi77bVgyBO/pGESDh7Ajhas+u0ttkGkKYIIAjniL4Bw5+oVejVF+SYkaI7XKfwCCyeTuA==", - "requires": { - "jws": "^3.2.1", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - } - }, - "jwa": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.3.0.tgz", - "integrity": "sha512-SxObIyzv9a6MYuZYaSN6DhSm9j3+qkokwvCB0/OTSV5ylPq1wUQiygZQcHT5Qlux0I5kmISx3J86TxKhuefItg==", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "jws": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.1.tgz", - "integrity": "sha512-bGA2omSrFUkd72dhh05bIAN832znP4wOU3lfuXtRBuGTbsmNmDXMQg28f0Vsxaxgk4myF5YkKQpz6qeRpMgX9g==", - "requires": { - "jwa": "^1.2.0", - "safe-buffer": "^5.0.1" - } - }, - "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" - }, - "url-join": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", - "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=" - } - } - }, "botbuilder-prompts": { "version": "4.0.0-preview1.2", "resolved": "https://registry.npmjs.org/botbuilder-prompts/-/botbuilder-prompts-4.0.0-preview1.2.tgz", @@ -3328,17 +3166,16 @@ } }, "botlib": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.12.tgz", - "integrity": "sha512-odBPlEBeYHSEfDfiTDknIp+/NM6Ar1q1TShXZ7xwc/+0CD90Y3dyjlVZDwiZtG2vfk5btiB8GjLzgP4v1nYE6A==", + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.19.tgz", + "integrity": "sha512-JssUqK0NVwLTvs2zcl42jpKTsB5ocse27aVnFukV+wGuAjCeZu6HZpaTue1jTCHojMXAH1TSLNQnuCOOTxpw/w==", "requires": { "async": "2.6.2", - "botbuilder": "4.2.1", - "botbuilder-ai": "4.2.1", - "botbuilder-azure": "4.2.1", + "botbuilder": "4.1.7", + "botbuilder-ai": "4.2.0", + "botbuilder-azure": "4.2.0", "botbuilder-choices": "4.0.0-preview1.2", - "botbuilder-dialogs": "4.2.1", - "botbuilder-location": "2.0.0", + "botbuilder-dialogs": "4.2.0", "botbuilder-prompts": "4.0.0-preview1.2", "chrono-node": "1.3.11", "dotenv-extended": "2.3.0", @@ -3346,118 +3183,12 @@ "ms": "2.1.1", "pragmatismo-io-framework": "1.0.19", "reflect-metadata": "0.1.13", - "sequelize": "4.42.0", + "sequelize": "4.42.1", "sequelize-typescript": "0.6.7", "wait-until": "0.0.2", "winston": "3.2.1" }, "dependencies": { - "@microsoft/recognizers-text-choice": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-choice/-/recognizers-text-choice-1.1.2.tgz", - "integrity": "sha512-4hFdqxusM0YrOXYM2RVYPl2rLjItSh6VkRiACjWB95GKC/DBGjJRYQpTxhzuZAsJSkDMinu/aLf8DvQtwUaLtA==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "grapheme-splitter": "^1.0.2" - } - }, - "@microsoft/recognizers-text-number": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.2.tgz", - "integrity": "sha512-GESjSF42dllym83diyd6pmlzFwdzidewoq/qSQz89lSoTx9HdJQHjbXxwdBp7w4Ax/Jroo2lcAedM3B7alZhYQ==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "bignumber.js": "^7.2.1", - "lodash.escaperegexp": "^4.1.2", - "lodash.sortby": "^4.7.0", - "lodash.trimend": "^4.5.1" - } - }, - "@microsoft/recognizers-text-suite": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-suite/-/recognizers-text-suite-1.1.2.tgz", - "integrity": "sha512-w3WCsKa//64jE1fGPFlV02rRg9+b3oDp+K5/skPAn4KDr80LjXxD1ulIgiJ2Ll/2OoBl8ociCiCjYA7zS3LpdQ==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "@microsoft/recognizers-text-choice": "~1.1.2", - "@microsoft/recognizers-text-date-time": "~1.1.2", - "@microsoft/recognizers-text-number": "~1.1.2", - "@microsoft/recognizers-text-number-with-unit": "~1.1.2", - "@microsoft/recognizers-text-sequence": "~1.1.2" - } - }, - "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" - }, - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "requires": { - "lodash": "^4.17.11" - } - }, - "botbuilder": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", - "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", - "async-file": "^2.0.2", - "botbuilder-core": "^4.2.1", - "botframework-connector": "^4.2.1", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" - } - }, - "botbuilder-ai": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.1.tgz", - "integrity": "sha512-gej7KR0iFIK38M4eIkGFOn+Tk7sMpzGTJgMVy/ctz21m6vQDGfqFLjJzDk4GRG9oLaZfq5bqUw5sLtepLAZcUg==", - "requires": { - "@microsoft/recognizers-text-date-time": "1.1.2", - "@types/html-entities": "^1.2.16", - "@types/node": "^9.3.0", - "@types/request-promise-native": "^1.0.10", - "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "^4.2.1", - "html-entities": "^1.2.1", - "moment": "^2.20.1", - "ms-rest": "^2.3.6", - "mstranslator": "^3.0.0", - "request": "^2.87.0", - "request-promise-native": "1.0.5" - } - }, - "botbuilder-azure": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.1.tgz", - "integrity": "sha512-YbdIF3Xp3m1Ei3EnPY3YyPPrH/u10pBplMTluPnc1Qptd1z5mRtuG02kLsG22SivQN7rhyA8WNSgHlAjXShpeg==", - "requires": { - "@types/node": "^9.3.0", - "azure-storage": "^2.10.2", - "botbuilder": "^4.2.1", - "documentdb": "1.14.5", - "flat": "^4.0.0", - "semaphore": "^1.1.0" - } - }, - "botbuilder-dialogs": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.1.tgz", - "integrity": "sha512-QHD9WigzC7rOJT0hb9Xzs/yHs1g/MOabJey8qxlZPdnnQqK5X8KJaZEEDnRqcUmLj/ydbxnxqImLEsMD5zlGag==", - "requires": { - "@microsoft/recognizers-text-choice": "1.1.2", - "@microsoft/recognizers-text-date-time": "1.1.2", - "@microsoft/recognizers-text-number": "1.1.2", - "@microsoft/recognizers-text-suite": "1.1.2", - "@types/node": "^9.3.0", - "botbuilder-core": "^4.2.1" - } - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3465,21 +3196,6 @@ "requires": { "safer-buffer": ">= 2.1.2 < 3" } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" - }, - "request-promise-native": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", - "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", - "requires": { - "request-promise-core": "1.1.1", - "stealthy-require": "^1.1.0", - "tough-cookie": ">=2.3.3" - } } } }, @@ -4343,9 +4059,9 @@ } }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", "dev": true }, "commitizen": { @@ -7183,9 +6899,9 @@ } }, "generic-pool": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.4.2.tgz", - "integrity": "sha512-H7cUpwCQSiJmAHM4c/aFu6fUfrhWXW1ncyh8ftxEPMu6AiYkHw9K8br720TGPZJbk5eOH2bynjZD1yPvdDAmag==" + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.5.0.tgz", + "integrity": "sha512-dEkxmX+egB2o4NR80c/q+xzLLzLX+k68/K8xv81XprD+Sk7ZtP14VugeCz+fUwv5FzpWq40pPtAkzPRqT8ka9w==" }, "get-caller-file": { "version": "1.0.3", @@ -9514,9 +9230,9 @@ "integrity": "sha1-dVSm+Nhxg0zJe1RisSLEwSTW3pE=" }, "mocha": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.0.1.tgz", - "integrity": "sha512-tQzCxWqxSD6Oyg5r7Ptbev0yAMD8p+Vfh4snPFuiUsWqYj0eVYTDT2DkEY307FTj0WRlIWN9rWMMAUzRmijgVQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.0.2.tgz", + "integrity": "sha512-RtTJsmmToGyeTznSOMoM6TPEk1A84FQaHIciKrRqARZx+B5ccJ5tXlmJzEKGBxZdqk9UjpRsesZTUkZmR5YnuQ==", "requires": { "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", @@ -13415,9 +13131,9 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nwsapi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.0.tgz", - "integrity": "sha512-ZG3bLAvdHmhIjaQ/Db1qvBxsGvFMLIRpQszyqbg31VJ53UP++uZX1/gf3Ut96pdwN9AuDwlMqIYLm0UPCdUeHg==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.1.tgz", + "integrity": "sha512-T5GaA1J/d34AC8mkrFD2O0DR17kwJ702ZOtJOsS8RpbsQZVOC2/xYFb1i/cw+xdM54JIlMuojjDOYct8GIWtwg==" }, "nyc": { "version": "13.3.0", @@ -15090,14 +14806,6 @@ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=" }, - "promise": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", - "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", - "requires": { - "asap": "~2.0.3" - } - }, "prop-types": { "version": "15.6.2", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", @@ -16315,16 +16023,16 @@ } }, "sequelize": { - "version": "4.42.0", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.42.0.tgz", - "integrity": "sha512-qxAYnX4rcv7PbNtEidb56REpxNJCdbN0qyk1jb3+e6sE7OrmS0nYMU+MFVbNTJtZfSpOEEL1TX0TkMw+wzZBxg==", + "version": "4.42.1", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.42.1.tgz", + "integrity": "sha512-W9i/CkBjCHLzEkJQkaxXaK82MA16b7F74PjtE7EUR+d7WU/X3U+YU5givWR+/VRXay1VXDyBOfXgw9/zdhDSDg==", "requires": { "bluebird": "^3.5.0", "cls-bluebird": "^2.1.0", "debug": "^3.1.0", "depd": "^1.1.0", "dottie": "^2.0.0", - "generic-pool": "^3.4.0", + "generic-pool": "3.5.0", "inflection": "1.12.0", "lodash": "^4.17.1", "moment": "^2.20.0", @@ -16449,9 +16157,9 @@ } }, "shimmer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.0.tgz", - "integrity": "sha512-xTCx2vohXC2EWWDqY/zb4+5Mu28D+HYNSOuFzsyRDRvI/e1ICb69afwaUwfjr+25ZXldbOLyp+iDUZHq8UnTag==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", + "integrity": "sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==" }, "shx": { "version": "0.3.2", @@ -17368,9 +17076,9 @@ } }, "swagger-client": { - "version": "3.8.24", - "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.8.24.tgz", - "integrity": "sha512-XFPOEz+IUPqIlYne2VAglYqqFBUykQvcVtfWbaE3BEu1xjAvCk1G873vj3NVQ0qR+2P1xq4VYMLCHqfqNGsLRA==", + "version": "3.8.25", + "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.8.25.tgz", + "integrity": "sha512-7ZtSSPnempsUbCAOJCQ6PyGaNkRoCm6ghOpJlI62ChfMGbLWtlOm8dLlgYiTkP9OAWuNHoRoTzOW14+QmZY1HA==", "requires": { "@kyleshockey/js-yaml": "^1.0.1", "@kyleshockey/object-assign-deep": "^0.4.0", @@ -17391,6 +17099,14 @@ "utfstring": "^2.0.0" }, "dependencies": { + "@kyleshockey/js-yaml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@kyleshockey/js-yaml/-/js-yaml-1.0.1.tgz", + "integrity": "sha512-coFyIk1LvTscq1cUU4nCCfYwv+cmG4fCP+wgDKgYZjhM4f++YwZy+g0k+1tUqa4GuUpBTEOGH2KUqKFFWdT73g==", + "requires": { + "argparse": "^1.0.7" + } + }, "deep-extend": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", @@ -17479,6 +17195,11 @@ } } }, + "temperature-js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/temperature-js/-/temperature-js-0.1.0.tgz", + "integrity": "sha512-j9XK8Pd+nMIYsQ0z4qL5ZlPf2/9CKPTqNN3eyG95hWHkLIbUA/AkjQPmL3MyeKuby1CwZihU2zqhmq9iRJxwJQ==" + }, "term-size": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", @@ -17906,9 +17627,9 @@ "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=" }, "tslint": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.1.tgz", - "integrity": "sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.0.tgz", + "integrity": "sha512-ECOOQRxXCYnUUePG5h/+Z1Zouobk3KFpIHA9aKBB/nnMxs97S1JJPDGt5J4cGm1y9U9VmVlfboOxA8n1kSNzGw==", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -17919,6 +17640,7 @@ "glob": "^7.1.1", "js-yaml": "^3.7.0", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", @@ -18050,9 +17772,9 @@ "integrity": "sha512-BJONvKQWolyNqnzjKQIJflsuvyjapsCPR07maHiRvUOXIbhY56SqmYs+VKevq7SIFXsnlfTEE7meP+6Y/Q2Pyw==" }, "typedoc-plugin-markdown": { - "version": "1.1.26", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-1.1.26.tgz", - "integrity": "sha512-OMl3HU346gGmPpaHndjHdMWVm6zdR1iSSRgd+Q0mMT4s2f5mijkZSrCe1SFr9meZG8bPMeQo+gNUZ36pGdL6iA==", + "version": "1.1.27", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-1.1.27.tgz", + "integrity": "sha512-i/ATsUETDxLAN/i4l525tLfEvjBRdPN2UEuZPEZ1CnkLIQFM1xjcIf3dFnAcIvj/qhrhrMQXfgjphqPATfTEtA==", "requires": { "turndown": "^5.0.3" } @@ -18647,9 +18369,9 @@ } }, "wkx": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.5.tgz", - "integrity": "sha512-01dloEcJZAJabLO5XdcRgqdKpmnxS0zIT02LhkdWOZX2Zs2tPM6hlZ4XG9tWaWur1Qd1OO4kJxUbe2+5BofvnA==", + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.6.tgz", + "integrity": "sha512-LHxXlzRCYQXA9ZHgs8r7Gafh0gVOE8o3QmudM1PIkOdkXXjW7Thcl+gb2P2dRuKgW8cqkitCRZkkjtmWzpHi7A==", "requires": { "@types/node": "*" } diff --git a/package.json b/package.json index 4863fb4b..c8fec51e 100644 --- a/package.json +++ b/package.json @@ -60,13 +60,13 @@ "azure-arm-website": "5.7.0", "bluebird": "^3.5.3", "body-parser": "1.18.3", - "botbuilder": "^4.2.1", - "botbuilder-ai": "^4.2.1", - "botbuilder-azure": "^4.2.1", - "botbuilder-choices": "^4.0.0-preview1.2", - "botbuilder-dialogs": "^4.2.1", - "botbuilder-prompts": "^4.0.0-preview1.2", - "botlib": "^0.1.12", + "botbuilder": "4.1.7", + "botbuilder-ai": "4.2.0", + "botbuilder-azure": "4.2.0", + "botbuilder-choices": "4.0.0-preview1.2", + "botbuilder-dialogs": "4.2.0", + "botbuilder-prompts": "4.0.0-preview1.2", + "botlib": "0.1.19", "chai": "4.2.0", "child_process": "^1.0.2", "chokidar": "2.1.2", @@ -80,32 +80,34 @@ "js-beautify": "^1.8.9", "localize": "0.4.7", "marked": "0.6.1", - "mocha": "6.0.1", + "mocha": "6.0.2", "mocha-typescript": "1.1.17", "ms": "2.1.1", "ms-rest-azure": "2.6.0", "nexmo": "2.4.1", - "ngrok": "^3.1.1", - "nyc": "^13.3.0", - "opn": "^5.4.0", + "ngrok": "3.1.1", + "nyc": "13.3.0", + "opn": "5.4.0", "pragmatismo-io-framework": "1.0.19", - "process-exists": "^3.1.0", + "process-exists": "3.1.0", "public-ip": "^3.0.0", "reflect-metadata": "0.1.13", + "request-promise": "4.2.4", "request-promise-native": "1.0.7", "scanf": "^1.0.2", - "sequelize": "4.42.0", + "sequelize": "4.42.1", "sequelize-typescript": "0.6.7", - "shx": "^0.3.2", - "simple-git": "^1.107.0", + "shx": "0.3.2", + "simple-git": "1.107.0", "sqlite3": "4.0.6", "strict-password-generator": "^1.1.2", - "swagger-client": "3.8.24", + "swagger-client": "3.8.25", "tedious": "5.0.3", + "temperature-js": "^0.1.0", "ts-node": "8.0.2", "typedoc": "0.14.2", "typedoc-plugin-external-module-name": "^2.0.0", - "typedoc-plugin-markdown": "^1.1.26", + "typedoc-plugin-markdown": "^1.1.27", "typescript": "3.3.3333", "url-join": "4.0.0", "vbscript-to-typescript": "^1.0.8", @@ -122,7 +124,7 @@ "@semantic-release/release-notes-generator": "^7.1.4", "@types/chai": "4.1.7", "@types/mocha": "5.2.6", - "@types/sequelize": "4.27.37", + "@types/sequelize": "4.27.38", "@types/url-join": "4.0.0", "@types/winston": "2.4.4", "ban-sensitive-files": "1.9.2", @@ -140,7 +142,7 @@ "standard": "12.0.1", "travis-deploy-once": "5.0.11", "ts-loader": "^5.3.3", - "tslint": "^5.12.1", + "tslint": "^5.13.0", "tslint-microsoft-contrib": "^6.0.0" }, "eslintConfig": { diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index 679f50fa..35e5adb1 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -102,6 +102,9 @@ export class StartDialog { authoringKey = this.retrieveAuthoringKey(); } + process.stdout.write(`${GBAdminService.GB_PROMPT}Thank you. That is enough information.\nNow building farm...`); + + // Prepares the first instance on bot farm. const instance: IGBInstance = {}; diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index d062353a..9ea23c35 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -93,10 +93,12 @@ export class GBConversationalService implements IGBConversationalService { public async routeNLP(step: any, min: GBMinInstance, text: string): Promise { // Invokes LUIS. + let endpoint = min.instance.nlpEndpoint.replace('/luis/v2.0', ''); + const model = new LuisRecognizer({ applicationId: min.instance.nlpAppId, endpointKey: min.instance.nlpKey, - endpoint: min.instance.nlpEndpoint + endpoint: endpoint }); let nlp: any; @@ -130,7 +132,7 @@ export class GBConversationalService implements IGBConversationalService { logger.info(`NLP called: ${intent}, ${entity}`); try { - await step.replace(`/${intent}`, nlp.entities); + await step.replaceDialog(`/${intent}`, nlp.entities); return Promise.resolve(true); } catch (error) { diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index 8716a1d7..bfc9a9ef 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -51,6 +51,7 @@ import { GBWhatsappPackage } from '../../whatsapp.gblib/index'; import { GuaribasInstance } from '../models/GBModel'; import { GBConfigService } from './GBConfigService'; import { StartDialog } from '../../azuredeployer.gbapp/dialogs/StartDialog'; +import { WaterfallDialog } from 'botbuilder-dialogs'; const logger = require('../../../src/logger'); const opn = require('opn'); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index bd4643e8..086cb54b 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -45,7 +45,7 @@ const AuthenticationContext = require('adal-node').AuthenticationContext; import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder'; -import { ConfirmPrompt } from 'botbuilder-dialogs'; +import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBPackage } from 'botlib'; import { GBAnalyticsPackage } from '../../analytics.gblib'; import { GBCorePackage } from '../../core.gbapp'; @@ -356,9 +356,15 @@ export class GBMinService { } }, this); - appPackages.forEach(e => { - e.sysPackages = sysPackages; - e.loadBot(min); + appPackages.forEach(p => { + p.sysPackages = sysPackages; + p.loadBot(min); + if (p.getDialogs !== undefined) { + let dialogs = p.getDialogs(min); + dialogs.forEach(dialog => { + min.dialogs.add(new WaterfallDialog(dialog.name, dialog.waterfall)); + }); + } }, this); } @@ -473,7 +479,6 @@ export class GBMinService { let isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined; if (isVMCall) { - let mainMethod = context.activity.text; min.sandbox.context = context; diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index eb667b7d..5d7bfa34 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -204,5 +204,7 @@ export class AskDialog extends IGBDialog { } ]) ); + + } } From a5a5f23ecd66ef9248813e8ea5813819bc038504 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 1 Mar 2019 15:38:10 -0300 Subject: [PATCH 15/32] chore(docs): Refactoring of .md. --- FEATURES.md | 8 ++++++++ ROADMAP.md | 6 ++++++ .../azuredeployer.gbapp/services/AzureDeployerService.ts | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 FEATURES.md create mode 100644 ROADMAP.md diff --git a/FEATURES.md b/FEATURES.md new file mode 100644 index 00000000..a6eb6219 --- /dev/null +++ b/FEATURES.md @@ -0,0 +1,8 @@ +# General Bots Features + +| Feature | BF | GB | +|----------------------------------------------------------------------------|----|----| +| Use of conversational administration to manage bot packages (Talk to admin | - | X | +| F5 to run on VSCode | - | X | +| Isolated code on packages | - | X | +| Breaking changes protected | - | X | diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 00000000..41824d4d --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,6 @@ +# Roadmap + +| Title | Priority | Release | Status | +|-------------------------------|------------------------------------------------------------------------------------------------------------|---------|--------| +| Isolation of .gbapp per .gbot | Today .gbapp loaded is shared across all bot instances and must be associated to one or more individually. | Medium | 2019Q4 | +| Python based .gbapps | Write conversational login in Python | Low | - | diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 3ea78a42..6f9195f3 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -324,6 +324,8 @@ export class AzureDeployerService extends GBService { instance.textAnalyticsEndpoint = textAnalytics.endpoint; instance.textAnalyticsKey = keys.key1; + // TODO: Check quotes being added when NLP field is filled. + logger.info(`Deploying NLP...`); const nlp = await this.createNLP(name, `${name}-nlp`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, nlp.name); From 2e49709fba92f46768bd408fcfb5dc2b1b73d313 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 1 Mar 2019 15:41:12 -0300 Subject: [PATCH 16/32] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 22d0eb5c..4eef756e 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,13 @@ Everyone can create bots by just copying and pasting some files and using their favorite tools from Office (or any text editor) or Photoshop (or any image editor). BASIC can be used to build custom dialogs so Bot can be extended just like VBA for Excel (currently in alpha). +## Samples + +[General Bots Samples Repository](https://github.com/GeneralBots-Samples). + ## Guide -[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/01%20-%20Overview.md). +[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/book/chapter-01-Index.md). ## Contributing @@ -86,3 +90,4 @@ our trademarks remain entirely with us. * See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018. [![See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-02-thumb.jpg)](https://www.youtube.com/watch?v=yX1sF9n9628) + From 0cb4cef9c9a51829803dcc8a3dbfa46abc392393 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 4 Mar 2019 09:42:33 -0300 Subject: [PATCH 17/32] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4eef756e..49a8ba3b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ editor). BASIC can be used to build custom dialogs so Bot can be extended just l ## Guide -[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/book/chapter-01-Index.md). +[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/book/chapter-01-index.md). ## Contributing @@ -91,3 +91,4 @@ our trademarks remain entirely with us. [![See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC](https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/video-02-thumb.jpg)](https://www.youtube.com/watch?v=yX1sF9n9628) + From 5d08457befe0d4c60cb751bb6a7e99064967f28f Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 8 Mar 2019 06:37:13 -0300 Subject: [PATCH 18/32] fix(general): tslint being applied in all sources. --- package-lock.json | 6 +- package.json | 2 +- packages/admin.gbapp/dialogs/AdminDialog.ts | 22 +- packages/admin.gbapp/index.ts | 9 +- .../admin.gbapp/services/GBAdminService.ts | 11 +- packages/analytics.gblib/index.ts | 4 +- .../dialogs/BotFarmDialog.ts | 18 +- .../dialogs/StartDialog.ts | 13 +- packages/azuredeployer.gbapp/index.ts | 4 +- .../services/AzureDeployerService.ts | 106 ++--- packages/console.gblib/index.ts | 16 +- packages/core.gbapp/index.ts | 24 +- packages/core.gbapp/models/GBModel.ts | 3 +- packages/core.gbapp/services/GBAPIService.ts | 53 ++- .../services/GBConversationalService.ts | 9 +- packages/core.gbapp/services/GBCoreService.ts | 46 +- packages/core.gbapp/services/GBDeployer.ts | 10 +- packages/core.gbapp/services/GBMinService.ts | 26 +- packages/core.gbapp/services/GBVMService.ts | 19 +- packages/customer-satisfaction.gbapp/index.ts | 20 +- packages/kb.gbapp/index.ts | 25 +- packages/kb.gbapp/services/KBService.ts | 7 +- packages/security.gblib/index.ts | 28 +- .../security.gblib/services/SecService.ts | 68 +-- packages/whatsapp.gblib/index.ts | 45 +- .../services/WhatsappDirectLine.ts | 441 ++++++++---------- src/app.ts | 15 +- tsconfig.json | 1 + 28 files changed, 459 insertions(+), 592 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9e5a51be..ea1d9d4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3166,9 +3166,9 @@ } }, "botlib": { - "version": "0.1.19", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.19.tgz", - "integrity": "sha512-JssUqK0NVwLTvs2zcl42jpKTsB5ocse27aVnFukV+wGuAjCeZu6HZpaTue1jTCHojMXAH1TSLNQnuCOOTxpw/w==", + "version": "0.1.21", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.21.tgz", + "integrity": "sha512-AF8Sp+SF3xN/jzOCo7tnqJfGaYkeHP0mJKcfYL0iHYbUuIVsCVtNmIottd1WTzDfKhls+ZoqclSAbzzoC0LS+Q==", "requires": { "async": "2.6.2", "botbuilder": "4.1.7", diff --git a/package.json b/package.json index c8fec51e..ef8cc94e 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "botbuilder-choices": "4.0.0-preview1.2", "botbuilder-dialogs": "4.2.0", "botbuilder-prompts": "4.0.0-preview1.2", - "botlib": "0.1.19", + "botlib": "^0.1.21", "chai": "4.2.0", "child_process": "^1.0.2", "chokidar": "2.1.2", diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index c3473f20..724acc5c 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -38,14 +38,14 @@ const UrlJoin = require('url-join'); import { BotAdapter } from 'botbuilder'; -import { WaterfallDialog, WaterfallStep, WaterfallStepContext } from 'botbuilder-dialogs'; -import { GBMinInstance } from 'botlib'; -import { IGBDialog } from 'botlib'; +import { WaterfallDialog } from 'botbuilder-dialogs'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { GBConfigService } from '../../core.gbapp/services/GBConfigService'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; import { GBImporter } from '../../core.gbapp/services/GBImporterService'; import { GBAdminService } from '../services/GBAdminService'; import { Messages } from '../strings'; +import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; /** * Dialogs for administration tasks. @@ -79,7 +79,10 @@ export class AdminDialog extends IGBDialog { } public static async rebuildIndexPackageCommand(min: GBMinInstance, text: string, deployer: GBDeployer) { - await deployer.rebuildIndex(min.instance); + await deployer.rebuildIndex( + min.instance, + new AzureDeployerService(deployer).getKBSearchSchema(min.instance.searchIndex) + ); } public static async addConnectionCommand(min: GBMinInstance, text: any) { @@ -136,7 +139,7 @@ export class AdminDialog extends IGBDialog { if (text === 'quit') { return await step.replaceDialog('/'); } else if (cmdName === 'createFarm') { - await AdminDialog.createFarmCommand(text, deployer); + await AdminDialog.createFarmCommand(text, min); return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'deployPackage') { @@ -224,9 +227,9 @@ export class AdminDialog extends IGBDialog { await min.adminService.setValue(min.instance.instanceId, 'AntiCSRFAttackState', state); - const url = `https://login.microsoftonline.com/${min.instance.authenticatorTenant}/oauth2/authorize?client_id=${ - min.instance.authenticatorClientId - }&response_type=code&redirect_uri=${UrlJoin( + const url = `https://login.microsoftonline.com/${ + min.instance.authenticatorTenant + }/oauth2/authorize?client_id=${min.instance.authenticatorClientId}&response_type=code&redirect_uri=${UrlJoin( min.instance.botEndpoint, min.instance.botId, '/token' @@ -234,10 +237,9 @@ export class AdminDialog extends IGBDialog { await step.context.sendActivity(Messages[locale].consent(url)); - return await step.replaceDialog('/ask', {isReturning: true}); + return await step.replaceDialog('/ask', { isReturning: true }); } ]) ); } - } diff --git a/packages/admin.gbapp/index.ts b/packages/admin.gbapp/index.ts index a7e22288..d3c5aef7 100644 --- a/packages/admin.gbapp/index.ts +++ b/packages/admin.gbapp/index.ts @@ -36,15 +36,18 @@ 'use strict'; -import urlJoin = require('url-join'); - import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { AdminDialog } from './dialogs/AdminDialog'; import { GuaribasAdmin } from './models/AdminModel'; export class GBAdminPackage implements IGBPackage { - public sysPackages: IGBPackage[] = null; + public sysPackages: IGBPackage[] = undefined; + + public unloadPackage(core: IGBCoreService): void {} + public getDialogs(min: GBMinInstance) {} + public unloadBot(min: GBMinInstance): void {} + public onNewSession(min: GBMinInstance, step: any): void {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasAdmin]); diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index 80c2d1f9..b8db0e5e 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -37,7 +37,7 @@ 'use strict'; import { AuthenticationContext, TokenResponse } from 'adal-node'; -import { IGBCoreService } from 'botlib'; +import { IGBCoreService, IGBAdminService } from 'botlib'; import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; import { GuaribasAdmin } from '../models/AdminModel'; const UrlJoin = require('url-join'); @@ -47,7 +47,7 @@ const PasswordGenerator = require('strict-password-generator').default; /** * Services for server administration. */ -export class GBAdminService { +export class GBAdminService implements IGBAdminService { public static GB_PROMPT: string = 'GeneralBots: '; public static masterBotInstanceId = 0; @@ -76,7 +76,7 @@ export class GBAdminService { return credentials; } - public static getRndPassword() { + public static getRndPassword(): string { const passwordGenerator = new PasswordGenerator(); const options = { upperCaseAlpha: true, @@ -105,7 +105,7 @@ export class GBAdminService { return name; } - public async setValue(instanceId: number, key: string, value: string): Promise { + public async setValue(instanceId: number, key: string, value: string) { const options = { where: {} }; options.where = { key: key }; let admin = await GuaribasAdmin.findOne(options); @@ -115,8 +115,7 @@ export class GBAdminService { } admin.value = value; admin.instanceId = instanceId; - - return admin.save(); + await admin.save(); } public async updateSecurityInfo( diff --git a/packages/analytics.gblib/index.ts b/packages/analytics.gblib/index.ts index 1c29bb77..3e0860b4 100644 --- a/packages/analytics.gblib/index.ts +++ b/packages/analytics.gblib/index.ts @@ -43,8 +43,8 @@ import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; export class GBAnalyticsPackage implements IGBPackage { - public sysPackages: IGBPackage[] = null; - + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void {} diff --git a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts index 19a95fb9..96fd56a3 100644 --- a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts @@ -40,6 +40,7 @@ import { BotAdapter } from 'botbuilder'; import { GBMinInstance } from 'botlib'; import { IGBDialog } from 'botlib'; import { Messages } from '../strings'; +import { WaterfallDialog } from 'botlib/node_modules/botbuilder-dialogs'; export class BotFarmDialog extends IGBDialog { /** @@ -49,21 +50,20 @@ export class BotFarmDialog extends IGBDialog { * @param min The minimal bot instance data. */ public static setup(bot: BotAdapter, min: GBMinInstance) { - min.dialogs.add('/createBotFarm', [ + min.dialogs.add(new WaterfallDialog ('/createBotFarm', [ async step => { const locale = step.context.activity.locale; - await step.prompt('choicePrompt', Messages[locale].what_about_me, [ - '1', - '2', - '3', - '4', - '5' - ]); + await step.prompt('choicePrompt', Messages[locale].what_about_me); + + return step.next(); }, async step => { + const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].thanks); + + return step.next(); } - ]); + ])); } } diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index 35e5adb1..8ceade28 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -37,18 +37,18 @@ 'use strict'; import { IGBInstance } from 'botlib'; +import { IGBInstallationDeployer } from 'botlib'; import * as fs from 'fs'; import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService'; -import { AzureDeployerService } from '../services/AzureDeployerService'; -import { GuaribasInstance } from '../../../packages/core.gbapp/models/GBModel'; const scanf = require('scanf'); /** * Handles command-line dialog for getting info for Boot Bot. */ export class StartDialog { - public static async createBaseInstance() { + + public static async createBaseInstance(installationDeployer: IGBInstallationDeployer) { // No .env so asks for cloud credentials to start a new farm. if (!fs.existsSync(`.env`)) { @@ -75,7 +75,7 @@ export class StartDialog { // Connects to the cloud and retrieves subscriptions. const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); - const list = await AzureDeployerService.getSubscriptions(credentials); + const list = await installationDeployer.getSubscriptions(credentials); let subscriptionId: string; while (subscriptionId === undefined) { @@ -104,9 +104,8 @@ export class StartDialog { process.stdout.write(`${GBAdminService.GB_PROMPT}Thank you. That is enough information.\nNow building farm...`); - // Prepares the first instance on bot farm. - const instance: IGBInstance = {}; + const instance = {}; instance.botId = botId; instance.cloudUsername = username; @@ -223,7 +222,7 @@ generate manually an App ID and App Secret.\n` private static retrieveLocation() { let location = GBConfigService.get('CLOUD_LOCATION'); if (!location) { - process.stdout.write("CLOUD_LOCATION (eg. 'westus'):"); + process.stdout.write('CLOUD_LOCATION (eg. \'westus\'):'); location = scanf('%s'); } diff --git a/packages/azuredeployer.gbapp/index.ts b/packages/azuredeployer.gbapp/index.ts index ff4ac32e..66d85906 100644 --- a/packages/azuredeployer.gbapp/index.ts +++ b/packages/azuredeployer.gbapp/index.ts @@ -40,8 +40,8 @@ import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; export class GBAzureDeployerPackage implements IGBPackage { - - public sysPackages: IGBPackage[] = null; + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 6f9195f3..012e0c95 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -43,33 +43,29 @@ import { SearchManagementClient } from 'azure-arm-search'; import { SqlManagementClient } from 'azure-arm-sql'; import { WebSiteManagementClient } from 'azure-arm-website'; import { AppServicePlan } from 'azure-arm-website/lib/models'; -import { GBService, IGBInstance } from 'botlib'; +import { IGBInstance, IGBInstallationDeployer } from 'botlib'; import { HttpMethods, ServiceClient, WebResource } from 'ms-rest-js'; -import { GBDeployer } from '../../../packages/core.gbapp/services/GBDeployer'; -import * as simplegit from 'simple-git/promise'; import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; import { GBCorePackage } from '../../../packages/core.gbapp'; import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService'; -import { GuaribasInstance } from '../../../packages/core.gbapp/models/GBModel'; +import { GBDeployer } from '../../../packages/core.gbapp/services/GBDeployer'; const Spinner = require('cli-spinner').Spinner; -const scanf = require('scanf'); -const git = simplegit(); const logger = require('../../../src/logger'); const UrlJoin = require('url-join'); const iconUrl = 'https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-logo-squared.png'; const publicIp = require('public-ip'); -export class AzureDeployerService extends GBService { - public static apiVersion = '2017-12-01'; - public static defaultEndPoint = 'http://localhost:4242'; +export class AzureDeployerService implements IGBInstallationDeployer { + public apiVersion = '2017-12-01'; + public defaultEndPoint = 'http://localhost:4242'; public instance: IGBInstance; public resourceClient: ResourceManagementClient.ResourceManagementClient; public webSiteClient: WebSiteManagementClient; public storageClient: SqlManagementClient; public cognitiveClient: CognitiveServicesManagementClient; public searchClient: SearchManagementClient; - public static provider = 'Microsoft.BotService'; + public provider = 'Microsoft.BotService'; public subscriptionClient: SubscriptionClient.SubscriptionClient; public accessToken: string; public location: string; @@ -78,15 +74,16 @@ export class AzureDeployerService extends GBService { public deployer: GBDeployer; constructor(deployer: GBDeployer) { - super(); this.deployer = deployer; } - public static async getSubscriptions(credentials) { + + public async getSubscriptions(credentials) { const subscriptionClient = new SubscriptionClient.default(credentials); + return subscriptionClient.subscriptions.list(); } - public static getKBSearchSchema(indexName) { + public getKBSearchSchema(indexName) { return { name: indexName, fields: [ @@ -187,16 +184,13 @@ export class AzureDeployerService extends GBService { }; } - public static async updateBotProxy(botId, group, endpoint) { + public async updateBotProxy(botId, group, endpoint) { const baseUrl = `https://management.azure.com/`; const username = GBConfigService.get('CLOUD_USERNAME'); const password = GBConfigService.get('CLOUD_PASSWORD'); const subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); - const accessToken = await GBAdminService.getADALTokenFromUsername( - username, - password - ); + const accessToken = await GBAdminService.getADALTokenFromUsername(username, password); const httpClient = new ServiceClient(); const parameters = { @@ -207,14 +201,9 @@ export class AzureDeployerService extends GBService { const query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ this.provider - }/botServices/${botId}?api-version=${AzureDeployerService.apiVersion}`; + }/botServices/${botId}?api-version=${this.apiVersion}`; const url = UrlJoin(baseUrl, query); - const req = this.createRequestObject( - url, - accessToken, - 'PATCH', - JSON.stringify(parameters) - ); + const req = AzureDeployerService.createRequestObject(url, accessToken, 'PATCH', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); if (!(res.bodyAsJson as any).id) { throw res.bodyAsText; @@ -222,7 +211,7 @@ export class AzureDeployerService extends GBService { logger.info(`Bot proxy updated at: ${endpoint}.`); } - public static async openStorageFirewall(groupName, serverName) { + public async openStorageFirewall(groupName, serverName) { const username = GBConfigService.get('CLOUD_USERNAME'); const password = GBConfigService.get('CLOUD_PASSWORD'); const subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID'); @@ -239,7 +228,7 @@ export class AzureDeployerService extends GBService { await storageClient.firewallRules.createOrUpdate(groupName, serverName, 'gb', params); } - public static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) { + private static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) { const req = new WebResource(); req.method = verb; req.url = url; @@ -304,19 +293,19 @@ export class AzureDeployerService extends GBService { instance.searchIndex = 'azuresql-index'; instance.searchIndexer = 'azuresql-indexer'; instance.searchKey = searchKeys.primaryKey; - this.deployer.rebuildIndex(instance); + this.deployer.rebuildIndex(instance, this.deployer); logger.info(`Deploying Speech...`); const speech = await this.createSpeech(name, `${name}-speech`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, speech.name); - instance.speechKeyEndpoint = speech.endpoint; + instance.speechEndpoint = speech.endpoint; instance.speechKey = keys.key1; logger.info(`Deploying SpellChecker...`); - const spellChecker = await this.createSpellChecker(name, `${name}-spellchecker`, instance.cloudLocation); + const spellChecker = await this.createSpellChecker(name, `${name}-spellchecker`); keys = await this.cognitiveClient.accounts.listKeys(name, spellChecker.name); - instance.spellCheckerKey = keys.key1; - instance.spellCheckerEndpoint = spellChecker.endpoint; + instance.spellcheckerKey = keys.key1; + instance.spellcheckerEndpoint = spellChecker.endpoint; logger.info(`Deploying Text Analytics...`); const textAnalytics = await this.createTextAnalytics(name, `${name}-textanalytics`, instance.cloudLocation); @@ -336,7 +325,7 @@ export class AzureDeployerService extends GBService { instance.nlpAppId = nlpAppId; logger.info(`Deploying Bot...`); - instance.botEndpoint = AzureDeployerService.defaultEndPoint; + instance.botEndpoint = this.defaultEndPoint; instance = await this.internalDeployBot( instance, @@ -349,8 +338,8 @@ export class AzureDeployerService extends GBService { 'global', instance.nlpAppId, instance.nlpKey, - instance.appId, - instance.appPassword, + instance.marketplaceId, + instance.marketplacePassword, instance.cloudSubscriptionId ); @@ -359,17 +348,16 @@ export class AzureDeployerService extends GBService { } public async deployToCloud( - title, - username, - password, - cloudLocation, - authoringKey, - appId, - appPassword, - subscriptionId + title: string, + username: string, + password: string, + cloudLocation: string, + authoringKey: string, + appId: string, + appPassword: string, + subscriptionId: string ) { - - const instance: IGBInstance = {}; + const instance = {}; instance.botId = title; instance.cloudUsername = username; @@ -397,18 +385,6 @@ export class AzureDeployerService extends GBService { this.accessToken = credentials.tokenCache._entries[0].accessToken; } - private async updateWebisteConfig(group, serverFarmId, name, location) { - const siteConfig = { - location: location, - serverFarmId: serverFarmId, - numberOfWorkers: 1, - phpVersion: '5.5' - }; - - // TODO: Copy .env to app settings. - - return this.webSiteClient.webApps.createOrUpdateConfiguration(group, name, siteConfig); - } private async createStorageServer(group, name, administratorLogin, administratorPassword, serverName, location) { const params = { @@ -423,7 +399,7 @@ export class AzureDeployerService extends GBService { private async registerProviders(subscriptionId, baseUrl, accessToken) { const query = `subscriptions/${subscriptionId}/providers/${ - AzureDeployerService.provider + this.provider }/register?api-version=2018-02-01`; const requestUrl = UrlJoin(baseUrl, query); @@ -436,7 +412,6 @@ export class AzureDeployerService extends GBService { req.headers.Authorization = 'Bearer ' + accessToken; const httpClient = new ServiceClient(); - const res = await httpClient.sendRequest(req); // TODO: Check res for error. } @@ -457,7 +432,7 @@ export class AzureDeployerService extends GBService { appId, appPassword, subscriptionId - ) { + ): Promise { return new Promise(async (resolve, reject) => { const baseUrl = `https://management.azure.com/`; await this.registerProviders(subscriptionId, baseUrl, accessToken); @@ -489,8 +464,8 @@ export class AzureDeployerService extends GBService { const httpClient = new ServiceClient(); let query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ - AzureDeployerService.provider - }/botServices/${botId}?api-version=${AzureDeployerService.apiVersion}`; + this.provider + }/botServices/${botId}?api-version=${this.apiVersion}`; let url = UrlJoin(baseUrl, query); let req = AzureDeployerService.createRequestObject(url, accessToken, 'PUT', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); @@ -502,7 +477,7 @@ export class AzureDeployerService extends GBService { setTimeout(async () => { try { query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/Microsoft.BotService/botServices/${botId}/channels/WebChatChannel/listChannelWithKeys?api-version=${ - AzureDeployerService.apiVersion + this.apiVersion }`; url = UrlJoin(baseUrl, query); req = AzureDeployerService.createRequestObject(url, accessToken, 'GET', JSON.stringify(parameters)); @@ -513,7 +488,7 @@ export class AzureDeployerService extends GBService { } catch (error) { reject(error); } - }, 20000); + }, 20000); }); } @@ -603,7 +578,7 @@ export class AzureDeployerService extends GBService { return await this.createCognitiveServices(group, name, location, 'LUIS'); } - private async createSpellChecker(group, name, location): Promise { + private async createSpellChecker(group, name): Promise { return await this.createCognitiveServices(group, name, 'global', 'Bing.SpellCheck.v7'); } @@ -637,5 +612,4 @@ export class AzureDeployerService extends GBService { }; return this.webSiteClient.webApps.createOrUpdate(group, name, parameters); } - } diff --git a/packages/console.gblib/index.ts b/packages/console.gblib/index.ts index 09eb4489..e056b050 100644 --- a/packages/console.gblib/index.ts +++ b/packages/console.gblib/index.ts @@ -44,22 +44,20 @@ import { Sequelize } from 'sequelize-typescript'; import { ConsoleDirectLine } from './services/ConsoleDirectLine'; export class GBConsolePackage implements IGBPackage { - public sysPackages: IGBPackage[] = null; + + public sysPackages: IGBPackage[] = undefined; public channel: ConsoleDirectLine; + public getDialogs(min: GBMinInstance) {} - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { - } + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} - public unloadPackage(core: IGBCoreService): void { - } + public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { this.channel = new ConsoleDirectLine(min.instance.webchatKey); } - public unloadBot(min: GBMinInstance): void { - } + public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void { - } + public onNewSession(min: GBMinInstance, step: any): void {} } diff --git a/packages/core.gbapp/index.ts b/packages/core.gbapp/index.ts index 0ea3b719..7166bfa6 100644 --- a/packages/core.gbapp/index.ts +++ b/packages/core.gbapp/index.ts @@ -40,7 +40,7 @@ const UrlJoin = require('url-join'); import { GBMinInstance, IGBPackage } from 'botlib'; -import { IGBCoreService} from 'botlib'; +import { IGBCoreService } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { WelcomeDialog } from './dialogs/WelcomeDialog'; import { WhoAmIDialog } from './dialogs/WhoAmIDialog'; @@ -48,30 +48,20 @@ import { GuaribasChannel, GuaribasException, GuaribasInstance, GuaribasPackage } export class GBCorePackage implements IGBPackage { public static CurrentEngineName = 'guaribas-1.0.0'; - public sysPackages: IGBPackage[] = null; + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { - core.sequelize.addModels([ - GuaribasInstance, - GuaribasPackage, - GuaribasChannel, - GuaribasException - ]); + core.sequelize.addModels([GuaribasInstance, GuaribasPackage, GuaribasChannel, GuaribasException]); } - public unloadPackage(core: IGBCoreService): void { - - } + public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { WelcomeDialog.setup(min.bot, min); WhoAmIDialog.setup(min.bot, min); } - public unloadBot(min: GBMinInstance): void { - - } - public onNewSession(min: GBMinInstance, step: any): void { - - } + public unloadBot(min: GBMinInstance): void {} + public onNewSession(min: GBMinInstance, step: any): void {} } diff --git a/packages/core.gbapp/models/GBModel.ts b/packages/core.gbapp/models/GBModel.ts index ca0bf05b..a382b92b 100644 --- a/packages/core.gbapp/models/GBModel.ts +++ b/packages/core.gbapp/models/GBModel.ts @@ -54,6 +54,7 @@ import { IGBInstance } from 'botlib'; @Table export class GuaribasInstance extends Model implements IGBInstance { + @PrimaryKey @AutoIncrement @Column @@ -152,7 +153,7 @@ export class GuaribasInstance extends Model public speechKey: string; @Column - public speechKeyEndpoint: string; + public speechEndpoint: string; @Column public spellcheckerKey: string; diff --git a/packages/core.gbapp/services/GBAPIService.ts b/packages/core.gbapp/services/GBAPIService.ts index 23335bfc..dccd0f39 100644 --- a/packages/core.gbapp/services/GBAPIService.ts +++ b/packages/core.gbapp/services/GBAPIService.ts @@ -35,22 +35,27 @@ import { TurnContext } from 'botbuilder'; import { WaterfallStepContext } from 'botbuilder-dialogs'; import { GBMinInstance } from 'botlib'; +import * as request from 'request-promise-native'; import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; - +import { GBDeployer } from './GBDeployer'; +const UrlJoin = require('url-join'); /** * BASIC system class for extra manipulation of bot behaviour. */ class SysClass { public min: GBMinInstance; + private readonly deployer: GBDeployer; - constructor(min: GBMinInstance) { + constructor(min: GBMinInstance, deployer: GBDeployer) { this.min = min; + this.deployer = deployer; } public async wait(seconds: number) { - const timeout = ms => new Promise(resolve => setTimeout(resolve, ms)); + // tslint:disable-next-line no-string-based-set-timeout + const timeout = async (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); await timeout(seconds * 1000); } @@ -68,7 +73,7 @@ class SysClass { appPassword, subscriptionId ) { - const service = new AzureDeployerService(this.min.deployer); + const service = new AzureDeployerService(this.deployer); await service.deployToCloud( botId, username, @@ -80,6 +85,27 @@ class SysClass { subscriptionId ); } + + /** + * Generic function to call any REST API. + */ + public async sendEmail(to, subject, body) { + // tslint:disable-next-line:no-console + console.log(`[E-mail]: to:${to}, subject: ${subject}, body: ${body}.`); + } + + /** + * Generic function to call any REST API. + */ + public async httpGet(url: string, qs) { + + const options = { + uri: UrlJoin(url , qs) + }; + + return await request.get(options); + } + } /** * @fileoverview General Bots server core. @@ -92,9 +118,9 @@ export default class DialogClass { public step: WaterfallStepContext; public internalSys: SysClass; - constructor(min: GBMinInstance) { + constructor(min: GBMinInstance, deployer: GBDeployer) { this.min = min; - this.internalSys = new SysClass(min); + this.internalSys = new SysClass(min, deployer); } public sys(): SysClass { @@ -102,7 +128,7 @@ export default class DialogClass { } public async hear(cb) { - const idCallback = Math.floor(Math.random() * 1000000000000); + const idCallback = crypto.getRandomValues(new Uint32Array(16))[0]; this.min.cbMap[idCallback] = cb; await this.step.beginDialog('/hear', { id: idCallback }); } @@ -110,17 +136,4 @@ export default class DialogClass { public async talk(text: string) { return await this.context.sendActivity(text); } - - /** - * Generic function to call any REST API. - */ - public sendEmail(to, subject, body) { - // tslint:disable-next-line:no-console - console.log(`[E-mail]: to:${to}, subject: ${subject}, body: ${body}.`); - } - - /** - * Generic function to call any REST API. - */ - public post(url: string, data) {} } diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 9ea23c35..3c83c608 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -39,7 +39,7 @@ const logger = require('../../../src/logger'); import { MessageFactory } from 'botbuilder'; import { LuisRecognizer } from 'botbuilder-ai'; -import { GBMinInstance, IGBConversationalService } from 'botlib'; +import { GBMinInstance, IGBConversationalService, IGBCoreService } from 'botlib'; import { AzureText } from 'pragmatismo-io-framework'; import { Messages } from '../strings'; import { GBCoreService } from './GBCoreService'; @@ -51,9 +51,10 @@ export interface LanguagePickerSettings { } export class GBConversationalService implements IGBConversationalService { - public coreService: GBCoreService; - constructor(coreService: GBCoreService) { + public coreService: IGBCoreService; + + constructor(coreService: IGBCoreService) { this.coreService = coreService; } @@ -93,7 +94,7 @@ export class GBConversationalService implements IGBConversationalService { public async routeNLP(step: any, min: GBMinInstance, text: string): Promise { // Invokes LUIS. - let endpoint = min.instance.nlpEndpoint.replace('/luis/v2.0', ''); + const endpoint = min.instance.nlpEndpoint.replace('/luis/v2.0', ''); const model = new LuisRecognizer({ applicationId: min.instance.nlpAppId, diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index bfc9a9ef..eefef487 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -36,12 +36,13 @@ 'use strict'; -import { IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; +import { IGBCoreService, IGBInstallationDeployer, IGBInstance, IGBPackage } from 'botlib'; import * as fs from 'fs'; import { Sequelize } from 'sequelize-typescript'; import { GBAdminPackage } from '../../admin.gbapp/index'; import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; import { GBAnalyticsPackage } from '../../analytics.gblib'; +import { StartDialog } from '../../azuredeployer.gbapp/dialogs/StartDialog'; import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBCorePackage } from '../../core.gbapp'; import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp'; @@ -50,8 +51,6 @@ import { GBSecurityPackage } from '../../security.gblib'; import { GBWhatsappPackage } from '../../whatsapp.gblib/index'; import { GuaribasInstance } from '../models/GBModel'; import { GBConfigService } from './GBConfigService'; -import { StartDialog } from '../../azuredeployer.gbapp/dialogs/StartDialog'; -import { WaterfallDialog } from 'botbuilder-dialogs'; const logger = require('../../../src/logger'); const opn = require('opn'); @@ -60,6 +59,7 @@ const opn = require('opn'); * Core service layer. */ export class GBCoreService implements IGBCoreService { + /** * Data access layer instance. */ @@ -162,13 +162,13 @@ export class GBCoreService implements IGBCoreService { } } - public async checkStorage(azureDeployer: AzureDeployerService) { + public async checkStorage(installationDeployer: IGBInstallationDeployer) { try { await this.sequelize.authenticate(); } catch (error) { logger.info('Opening storage firewall on infrastructure...'); if (error.parent.code === 'ELOGIN') { - await this.openStorageFrontier(azureDeployer); + await this.openStorageFrontier(installationDeployer); } else { throw error; } @@ -193,14 +193,14 @@ export class GBCoreService implements IGBCoreService { /** * Loads all items to start several listeners. */ - public async loadInstances(): Promise { + public async loadInstances(): Promise { return GuaribasInstance.findAll({}); } /** * Loads just one Bot instance by its internal Id. */ - public async loadInstanceById(instanceId: string): Promise { + public async loadInstanceById(instanceId: number): Promise { const options = { where: { instanceId: instanceId } }; return GuaribasInstance.findOne(options); @@ -240,8 +240,15 @@ STORAGE_SYNC=true public async ensureProxy(port): Promise { try { - const ngrok = require('ngrok'); - return await ngrok.connect({ port: port }); + if (fs.existsSync('node_modules/ngrok/bin/ngrok.exe')) { + const ngrok = require('ngrok'); + + return await ngrok.connect({ port: port }); + } else { + logger.warn('ngrok executable not found. Check installation or node_modules folder.'); + + return 'localhost'; + } } catch (error) { // There are false positive from ngrok regarding to no memory, but it's just // lack of connection. @@ -267,15 +274,15 @@ STORAGE_SYNC=true * @param azureDeployer * @param proxyAddress */ - public async loadAllInstances(core: GBCoreService, azureDeployer: AzureDeployerService, proxyAddress: string) { + public async loadAllInstances(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string) { logger.info(`Loading instances from storage...`); - let instances: GuaribasInstance[]; + let instances: IGBInstance[]; try { instances = await core.loadInstances(); const instance = instances[0]; if (process.env.NODE_ENV === 'development') { logger.info(`Updating bot endpoint to local reverse proxy (ngrok)...`); - await AzureDeployerService.updateBotProxy( + await installationDeployer.updateBotProxy( instance.botId, instance.botId, `${proxyAddress}/api/messages/${instance.botId}` @@ -308,9 +315,9 @@ STORAGE_SYNC=true * @param bootInstance * @param core */ - public async ensureInstances(instances: GuaribasInstance[], bootInstance: any, core: GBCoreService) { + public async ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService) { if (!instances) { - const instance: IGBInstance = {}; + const instance = new GuaribasInstance(); await instance.save(); instances = await core.loadInstances(); } @@ -347,11 +354,12 @@ STORAGE_SYNC=true } } - public async createBootInstance(core: GBCoreService, azureDeployer: AzureDeployerService, proxyAddress: string) { + public async createBootInstance(core: GBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string) { + logger.info(`Deploying cognitive infrastructure (on the cloud / on premises)...`); try { - let { instance, credentials, subscriptionId } = await StartDialog.createBaseInstance(); - instance = await azureDeployer.deployFarm(proxyAddress, instance, credentials, subscriptionId); + let { instance, credentials, subscriptionId } = await StartDialog.createBaseInstance(installationDeployer); + instance = await installationDeployer.deployFarm(proxyAddress, instance, credentials, subscriptionId); core.writeEnv(instance); logger.info(`File .env written, starting General Bots...`); GBConfigService.init(); @@ -457,9 +465,9 @@ STORAGE_SYNC=true * * @param azureDeployer Infrastructure Deployer instance. */ - private async openStorageFrontier(deployer: AzureDeployerService) { + private async openStorageFrontier(installationDeployer: IGBInstallationDeployer) { const group = GBConfigService.get('CLOUD_GROUP'); const serverName = GBConfigService.get('STORAGE_SERVER').split('.database.windows.net')[0]; - await AzureDeployerService.openStorageFirewall(group, serverName); + await installationDeployer.openStorageFirewall(group, serverName); } } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 1234aa89..b526a48b 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -73,7 +73,7 @@ export class GBDeployer { this.importer = importer; } - public static getConnectionStringFromInstance(instance: GuaribasInstance) { + public static getConnectionStringFromInstance(instance: IGBInstance) { return `Server=tcp:${instance.storageServer}.database.windows.net,1433;Database=${instance.storageName};User ID=${ instance.storageUsername };Password=${instance.storagePassword};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;`; @@ -272,7 +272,7 @@ export class GBDeployer { } } - public async rebuildIndex(instance: GuaribasInstance) { + public async rebuildIndex(instance: IGBInstance, searchSchema: any) { const search = new AzureSearch( instance.searchKey, instance.searchHost, @@ -302,7 +302,7 @@ export class GBDeployer { throw err; } } - await search.createIndex(AzureDeployerService.getKBSearchSchema(instance.searchIndex), dsName); + await search.createIndex(searchSchema, dsName); } public async getPackageByName(instanceId: number, packageName: string): Promise { @@ -312,7 +312,7 @@ export class GBDeployer { }); } - public installDefaultGBUI() { + public runOnce() { const root = 'packages/default.gbui'; if (!Fs.existsSync(`${root}/build`)) { logger.info(`Preparing default.gbui (it may take some additional time for the first time)...`); @@ -323,7 +323,7 @@ export class GBDeployer { } private async deployDataPackages( - core: GBCoreService, + core: IGBCoreService, botPackages: string[], _this: this, generalPackages: string[], diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 086cb54b..738b942a 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -46,7 +46,7 @@ const AuthenticationContext = require('adal-node').AuthenticationContext; import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder'; import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBPackage, IGBInstance } from 'botlib'; import { GBAnalyticsPackage } from '../../analytics.gblib'; import { GBCorePackage } from '../../core.gbapp'; import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp'; @@ -97,12 +97,12 @@ export class GBMinService { * */ public async buildMin( - bootInstance: GuaribasInstance, + bootInstance: IGBInstance, server: any, appPackages: IGBPackage[], - instances: GuaribasInstance[], + instances: IGBInstance[], deployer: GBDeployer - ): Promise { + ) { // Serves default UI on root address '/'. const uiPackage = 'default.gbui'; @@ -166,9 +166,9 @@ export class GBMinService { ); } - private handleOAuthTokenRequests(server: any, min: GBMinInstance, instance: GuaribasInstance) { + private handleOAuthTokenRequests(server: any, min: GBMinInstance, instance: IGBInstance) { server.get(`/${min.instance.botId}/token`, async (req, res) => { - const state = await min.adminService.getValue(min.instance.instanceId, 'AntiCSRFAttackState'); + const state = await min.adminService.getValue(instance.instanceId, 'AntiCSRFAttackState'); if (req.query.state !== state) { const msg = 'WARNING: state field was not provided as anti-CSRF token'; logger.error(msg); @@ -218,7 +218,7 @@ export class GBMinService { /** * Returns the instance object to clients requesting bot info. */ - private async sendInstanceToClient(req, bootInstance: GuaribasInstance, res: any, webchatToken: any) { + private async sendInstanceToClient(req, bootInstance: IGBInstance, res: any, webchatToken: any) { let botId = req.params.botId; if (botId === '[default]') { botId = bootInstance.botId; @@ -351,7 +351,7 @@ export class GBMinService { if (sysPackage.name === 'GBWhatsappPackage') { const url = '/instances/:botId/whatsapp'; server.post(url, (req, res) => { - p.channel.received(req, res); + p['channel'].received(req, res); }); } }, this); @@ -383,7 +383,7 @@ export class GBMinService { await adapter.processActivity(req, res, async context => { // Get loaded user state const state = await conversationState.get(context); - const step = await min.dialogs.createContext(context, state); + const step = await min.dialogs.createContext(context); step.context.activity.locale = 'en-US'; // TODO: Make dynamic. try { @@ -481,10 +481,10 @@ export class GBMinService { if (isVMCall) { let mainMethod = context.activity.text; - min.sandbox.context = context; - min.sandbox.step = step; - min.sandbox[mainMethod].bind(min.sandbox); - await min.sandbox[mainMethod](); + min.sandBoxMap[mainMethod].context = context; + min.sandBoxMap[mainMethod].step = step; + min.sandBoxMap[mainMethod][mainMethod].bind(min.sandBoxMap[mainMethod]); + await min.sandBoxMap[mainMethod][mainMethod](); } else if (context.activity.text === 'admin') { await step.beginDialog('/admin'); diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index 0f999824..40a7afff 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -33,10 +33,11 @@ 'use strict'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance, IGBCoreService } from 'botlib'; +import { GBMinInstance, IGBCoreService, GBService } from 'botlib'; import * as fs from 'fs'; import { GBDeployer } from './GBDeployer'; import { TSCompiler } from './TSCompiler'; +import GBAPIService from './GBAPIService'; import DialogClass from './GBAPIService'; const walkPromise = require('walk-promise'); @@ -44,7 +45,7 @@ const logger = require('../../../src/logger'); const vm = require('vm'); const UrlJoin = require('url-join'); const vb2ts = require('vbscript-to-typescript/dist/converter'); -var beautify = require('js-beautify').js; +let beautify = require('js-beautify').js; /** * @fileoverview Virtualization services for emulation of BASIC. @@ -55,7 +56,7 @@ var beautify = require('js-beautify').js; * translation and enhance classic BASIC experience. */ -export class GBVMService implements IGBCoreService { +export class GBVMService extends GBService { private readonly script = new vm.Script(); public async loadDialogPackage(folder: string, min: GBMinInstance, core: IGBCoreService, deployer: GBDeployer) { @@ -110,6 +111,10 @@ export class GBVMService implements IGBCoreService { return 'let password = sys().generatePassword()'; }); + code = code.replace(/(get)(\s)(.*)/g, ($0, $1, $2) => { + return `sys().httpGet (${$2})`; + }); + code = code.replace(/(create a bot farm using)(\s)(.*)/g, ($0, $1, $2, $3) => { return `sys().createABotFarmUsing (${$3})`; }); @@ -207,14 +212,14 @@ export class GBVMService implements IGBCoreService { parsedCode = this.handleThisAndAwait(parsedCode); - parsedCode = beautify(parsedCode, { indent_size: 2, space_in_empty_paren: true }) + parsedCode = beautify(parsedCode, { indent_size: 2, space_in_empty_paren: true }); fs.writeFileSync(jsfile, parsedCode); - const sandbox: DialogClass = new DialogClass(min); + const sandbox: DialogClass = new DialogClass(min, deployer); const context = vm.createContext(sandbox); vm.runInContext(parsedCode, context); - min.sandbox = sandbox; - await deployer.deployScriptToStorage(min.instanceId, filename); + min.sandBoxMap[mainName] = sandbox; + await deployer.deployScriptToStorage(1, filename); // TODO: Per bot storage. logger.info(`[GBVMService] Finished loading of ${filename}`); } } diff --git a/packages/customer-satisfaction.gbapp/index.ts b/packages/customer-satisfaction.gbapp/index.ts index 5324b258..33782cf6 100644 --- a/packages/customer-satisfaction.gbapp/index.ts +++ b/packages/customer-satisfaction.gbapp/index.ts @@ -45,23 +45,17 @@ import { GuaribasQuestionAlternate } from './models/index'; import { Sequelize } from 'sequelize-typescript'; export class GBCustomerSatisfactionPackage implements IGBPackage { - public sysPackages: IGBPackage[] = null; - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { - core.sequelize.addModels([ - GuaribasQuestionAlternate - ]); - } - public unloadPackage(core: IGBCoreService): void { + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { + core.sequelize.addModels([GuaribasQuestionAlternate]); } + public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { FeedbackDialog.setup(min.bot, min); QualityDialog.setup(min.bot, min); } - public unloadBot(min: GBMinInstance): void { - - } - public onNewSession(min: GBMinInstance, step: any): void { - - } + public unloadBot(min: GBMinInstance): void {} + public onNewSession(min: GBMinInstance, step: any): void {} } diff --git a/packages/kb.gbapp/index.ts b/packages/kb.gbapp/index.ts index da3628c0..9eba17b8 100644 --- a/packages/kb.gbapp/index.ts +++ b/packages/kb.gbapp/index.ts @@ -48,31 +48,18 @@ import { FaqDialog } from './dialogs/FaqDialog'; import { MenuDialog } from './dialogs/MenuDialog'; export class GBKBPackage implements IGBPackage { - - public sysPackages: IGBPackage[] = null; + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { - core.sequelize.addModels([ - GuaribasAnswer, - GuaribasQuestion, - GuaribasSubject - ]); - - } - public unloadPackage(core: IGBCoreService): void { - + core.sequelize.addModels([GuaribasAnswer, GuaribasQuestion, GuaribasSubject]); } + public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { - AskDialog.setup(min.bot, min); FaqDialog.setup(min.bot, min); MenuDialog.setup(min.bot, min); - - } - public unloadBot(min: GBMinInstance): void { - - } - public onNewSession(min: GBMinInstance, step: any): void { - } + public unloadBot(min: GBMinInstance): void {} + public onNewSession(min: GBMinInstance, step: any): void {} } diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 231dd7f8..fc47a0e4 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -53,6 +53,7 @@ import { GuaribasPackage } from '../../core.gbapp/models/GBModel'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from '../models'; import { GBConfigService } from './../../core.gbapp/services/GBConfigService'; +import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; export class KBServiceSearchResults { public answer: GuaribasAnswer; @@ -326,7 +327,7 @@ export class KBService { }); if (lastAnswer && lastQuestionId) { - await lastAnswer.updateAttributes({ nextId: lastQuestionId }); + await lastAnswer.update({ nextId: lastQuestionId }); } lastAnswer = answer1; lastQuestionId = question1.questionId; @@ -449,7 +450,7 @@ export class KBService { where: { instanceId: instance.instanceId, packageId: packageId } }); - await deployer.rebuildIndex(instance); + await deployer.rebuildIndex(instance, new AzureDeployerService(deployer).getKBSearchSchema(instance.searchIndex)); } /** @@ -468,7 +469,7 @@ export class KBService { const p = await deployer.deployPackageToStorage(instance.instanceId, packageName); await this.importKbPackage(localPath, p, instance); - deployer.rebuildIndex(instance); + deployer.rebuildIndex(instance, new AzureDeployerService(deployer).getKBSearchSchema(instance.searchIndex)); logger.info(`[GBDeployer] Finished import of ${localPath}`); } } diff --git a/packages/security.gblib/index.ts b/packages/security.gblib/index.ts index 90ba69ac..0ae9674a 100644 --- a/packages/security.gblib/index.ts +++ b/packages/security.gblib/index.ts @@ -44,29 +44,17 @@ import { Sequelize } from 'sequelize-typescript'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models'; export class GBSecurityPackage implements IGBPackage { - public sysPackages: IGBPackage[] = null; + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { - core.sequelize.addModels([ - GuaribasGroup, - GuaribasUser, - GuaribasUserGroup - ]); - - core; + core.sequelize.addModels([GuaribasGroup, GuaribasUser, GuaribasUserGroup]); } - public unloadPackage(core: IGBCoreService): void { + public unloadPackage(core: IGBCoreService): void {} - } + public loadBot(min: GBMinInstance): void {} - public loadBot(min: GBMinInstance): void { - - } - - public unloadBot(min: GBMinInstance): void { - - } - public onNewSession(min: GBMinInstance, step: any): void { - - } + public unloadBot(min: GBMinInstance): void {} + public onNewSession(min: GBMinInstance, step: any): void {} } diff --git a/packages/security.gblib/services/SecService.ts b/packages/security.gblib/services/SecService.ts index 277b0081..8ced609b 100644 --- a/packages/security.gblib/services/SecService.ts +++ b/packages/security.gblib/services/SecService.ts @@ -1,52 +1,12 @@ -/*****************************************************************************\ -| ( )_ _ | -| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | -| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | -| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | -| | | ( )_) | | -| (_) \___/' | -| | -| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | -| Licensed under the AGPL-3.0. | -| | -| According to our dual licensing model, this program can be used either | -| under the terms of the GNU Affero General Public License, version 3, | -| or under a proprietary license. | -| | -| The texts of the GNU Affero General Public License with an additional | -| permission and of our proprietary license can be found at and | -| in the LICENSE file you have received along with this program. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY, without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Affero General Public License for more details. | -| | -| "General Bots" is a registered trademark of Pragmatismo.io. | -| The licensing of the program under the AGPLv3 does not imply a | -| trademark license. Therefore any rights, title and interest in | -| our trademarks remain entirely with us. | -| | -\*****************************************************************************/ - -const Path = require('path'); const Fs = require('fs'); -const _ = require('lodash'); -const Parse = require('csv-parse'); -const Async = require('async'); const UrlJoin = require('url-join'); -const logger = require('../../../src/logger'); -import { GBService, GBServiceCallback, IGBInstance } from 'botlib'; +import { GBService, IGBInstance } from 'botlib'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from '../models'; export class SecService extends GBService { - public async importSecurityFile(localPath: string, instance: IGBInstance) { - const security = JSON.parse( - Fs.readFileSync(UrlJoin(localPath, 'security.json'), 'utf8') - ); + const security = JSON.parse(Fs.readFileSync(UrlJoin(localPath, 'security.json'), 'utf8')); security.groups.forEach(group => { const groupDb = GuaribasGroup.build({ instanceId: instance.instanceId, @@ -78,16 +38,15 @@ export class SecService extends GBService { channelName: string, displayName: string ): Promise { - return new Promise( - (resolve, reject) => { - - GuaribasUser.findOne({ - attributes: ['instanceId', 'internalAddress'], - where: { - instanceId: instanceId, - userSystemId: userSystemId - } - }).then(user => { + return new Promise((resolve, reject) => { + GuaribasUser.findOne({ + attributes: ['instanceId', 'internalAddress'], + where: { + instanceId: instanceId, + userSystemId: userSystemId + } + }) + .then(user => { if (!user) { user = GuaribasUser.build(); } @@ -99,7 +58,8 @@ export class SecService extends GBService { user.defaultChannel = channelName; user.save(); resolve(user); - }).error(reject); - }); + }) + .error(reject); + }); } } diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts index 5bc37b89..ea79e0d1 100644 --- a/packages/whatsapp.gblib/index.ts +++ b/packages/whatsapp.gblib/index.ts @@ -44,31 +44,30 @@ import { Sequelize } from 'sequelize-typescript'; import { WhatsappDirectLine } from './services/WhatsappDirectLine'; export class GBWhatsappPackage implements IGBPackage { + public sysPackages: IGBPackage[] = undefined; + public getDialogs(min: GBMinInstance) {} - public sysPackages: IGBPackage[] = null; - public channel: WhatsappDirectLine; + public channel: WhatsappDirectLine; - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} + + public unloadPackage(core: IGBCoreService): void {} + + public loadBot(min: GBMinInstance): void { + // Only loads engine if it is defined on services.json. + + if (min.instance.whatsappBotKey) { + this.channel = new WhatsappDirectLine( + min.botId, + min.instance.whatsappBotKey, + min.instance.whatsappServiceKey, + min.instance.whatsappServiceNumber, + min.instance.whatsappServiceUrl, + min.instance.whatsappServiceWebhookUrl + ); } + } - public unloadPackage(core: IGBCoreService): void { - - } - - public loadBot(min: GBMinInstance): void { - - // Only loads engine if it is defined on services.json. - - if (min.instance.whatsappBotKey) { - this.channel = new WhatsappDirectLine(min.botId, min.instance.whatsappBotKey, min.instance.whatsappServiceKey, - min.instance.whatsappServiceNumber, min.instance.whatsappServiceUrl, min.instance.whatsappServiceWebhookUrl); - } - } - - public unloadBot(min: GBMinInstance): void { - - } - public onNewSession(min: GBMinInstance, step: any): void { - - } + public unloadBot(min: GBMinInstance): void {} + public onNewSession(min: GBMinInstance, step: any): void {} } diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 5203524e..0344b352 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -1,266 +1,213 @@ -/*****************************************************************************\ -| ( )_ _ | -| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | -| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | -| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | -| | | ( )_) | | -| (_) \___/' | -| | -| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | -| Licensed under the AGPL-3.0. | -| | -| According to our dual licensing model, this program can be used either | -| under the terms of the GNU Affero General Public License, version 3, | -| or under a proprietary license. | -| | -| The texts of the GNU Affero General Public License with an additional | -| permission and of our proprietary license can be found at and | -| in the LICENSE file you have received along with this program. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY, without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Affero General Public License for more details. | -| | -| "General Bots" is a registered trademark of Pragmatismo.io. | -| The licensing of the program under the AGPLv3 does not imply a | -| trademark license. Therefore any rights, title and interest in | -| our trademarks remain entirely with us. | -| | -\*****************************************************************************/ - -const Path = require('path'); -const Fs = require('fs'); -const _ = require('lodash'); -const Parse = require('csv-parse'); -const Async = require('async'); const UrlJoin = require('url-join'); const logger = require('../../../src/logger'); const Swagger = require('swagger-client'); const rp = require('request-promise'); +import { GBService } from 'botlib'; import * as request from 'request-promise-native'; -import { GBService, GBServiceCallback, IGBInstance } from 'botlib'; - export class WhatsappDirectLine extends GBService { + public pollInterval = 1000; + public directLineClientName = 'DirectLineClient'; + public directLineSpecUrl = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json'; - public pollInterval = 1000; - public directLineClientName = 'DirectLineClient'; - public directLineSpecUrl = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json'; + public directLineClient: any; + public whatsappServiceKey: string; + public whatsappServiceNumber: string; + public whatsappServiceUrl: string; + public whatsappServiceWebhookUrl: string; + public botId: string; + public watermark: string = null; - public directLineClient: any; - public whatsappServiceKey: string; - public whatsappServiceNumber: string; - public whatsappServiceUrl: string; - public whatsappServiceWebhookUrl: string; - public botId: string; - public watermark: string = null; + public conversationIds = {}; - public conversationIds = {}; + constructor( + botId, + directLineSecret, + whatsappServiceKey, + whatsappServiceNumber, + whatsappServiceUrl, + whatsappServiceWebhookUrl + ) { + super(); - constructor(botId, directLineSecret, whatsappServiceKey, whatsappServiceNumber, whatsappServiceUrl, whatsappServiceWebhookUrl) { + this.botId = botId; + this.whatsappServiceKey = whatsappServiceKey; + this.whatsappServiceNumber = whatsappServiceNumber; + this.whatsappServiceUrl = whatsappServiceUrl; + this.whatsappServiceWebhookUrl = whatsappServiceWebhookUrl; - super(); - - this.botId = botId; - this.whatsappServiceKey = whatsappServiceKey; - this.whatsappServiceNumber = whatsappServiceNumber; - this.whatsappServiceUrl = whatsappServiceUrl; - this.whatsappServiceWebhookUrl = whatsappServiceWebhookUrl; - - // TODO: Migrate to Swagger 3. - this.directLineClient = rp(this.directLineSpecUrl) - .then((spec) => { - return new Swagger({ - spec: JSON.parse(spec.trim()), - usePromise: true - }); - }) - .then(async (client) => { - client.clientAuthorizations.add('AuthorizationBotConnector', - new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + - directLineSecret, 'header')); - - const options = { - method: 'POST', - url: UrlJoin(this.whatsappServiceUrl, 'webhook'), - qs: - { - token: this.whatsappServiceKey, - webhookUrl: `${this.whatsappServiceWebhookUrl}/instances/${this.botId}/whatsapp`, - set: true - }, - headers: - { - 'cache-control': 'no-cache' - } - }; - - try { - const result = await request.post(options); - logger.info(result); - } catch (error) { - logger.error('Error initializing 3rd party Whatsapp provider.', error); - } - - return client; - }) - .catch((err) => { - logger.error('Error initializing DirectLine client', err); - }); - - } - - public received(req, res) { - const text = req.body.messages[0].body; - const from = req.body.messages[0].author.split('@')[0]; - const fromName = req.body.messages[0].senderName; - - if (req.body.messages[0].fromMe) { - return; // Exit here. - } - - logger.info(`GBWhatsapp: Hook called. from: ${from}(${fromName}), text: ${text})`); - - const conversationId = this.conversationIds[from]; - - this.directLineClient.then((client) => { - - if (this.conversationIds[from] == null) { - - logger.info(`GBWhatsapp: Starting new conversation on Bot.`); - client.Conversations.Conversations_StartConversation() - .then((response) => { - return response.obj.conversationId; - }) - .then((conversationId) => { - - this.conversationIds[from] = conversationId; - this.inputMessage(client, conversationId, text, - from, fromName); - - this.pollMessages(client, conversationId, from, fromName); - }) - .catch((err) => { - console.error('Error starting conversation', err); - }); - - } else { - this.inputMessage(client, conversationId, text, - from, fromName); - } - res.end(); + // TODO: Migrate to Swagger 3. + this.directLineClient = rp(this.directLineSpecUrl) + .then(spec => { + return new Swagger({ + spec: JSON.parse(spec.trim()), + usePromise: true }); - } + }) + .then(async client => { + client.clientAuthorizations.add( + 'AuthorizationBotConnector', + new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header') + ); - public inputMessage(client, conversationId, text, from, fromName) { - - client.Conversations.Conversations_PostActivity( - { - conversationId: conversationId, - activity: { - textFormat: 'plain', - text: text, - type: 'message', - from: { - id: from, - name: fromName - }, - replyToId: from - } - }).catch((err) => { - logger.error(`GBWhatsapp: Error receiving message: ${err}.`); - }); - - } - - public pollMessages(client, conversationId, from, fromName) { - - logger.info(`GBWhatsapp: Starting polling message for conversationId: - ${conversationId}.`); - - setInterval(() => { - client.Conversations.Conversations_GetActivities({ - conversationId: - conversationId, watermark: this.watermark - }) - .then((response) => { - this.watermark = response.obj.watermark; - return response.obj.activities; - }) - .then((activities) => { - this.printMessages(activities, conversationId, from, fromName); - }); - }, this.pollInterval); - } - - public printMessages(activities, conversationId, from, fromName) { - - if (activities && activities.length) { - - // Ignore own messages. - - activities = activities.filter((m) => (m.from.id === 'GeneralBots') && m.type === 'message'); - - if (activities.length) { - - // Print other messages. - - activities.forEach(activity => { - this.printMessage(activity, conversationId, from, fromName); - }); - } - } - } - - public printMessage(activity, conversationId, from, fromName) { - - let output = ''; - - if (activity.text) { - logger.info(`GBWhatsapp: MSG: ${activity.text}`); - output = activity.text; - } - - if (activity.attachments) { - activity.attachments.forEach((attachment) => { - switch (attachment.contentType) { - case 'application/vnd.microsoft.card.hero': - output += `\n${this.renderHeroCard(attachment)}`; - break; - - case 'image/png': - logger.info('Opening the requested image ' + attachment.contentUrl); - output += `\n${attachment.contentUrl}`; - break; - } - }); - } - - this.sendToDevice(conversationId, from, fromName, output); - } - - public renderHeroCard(attachment) { - return `${attachment.content.title} - ${attachment.content.text}`; - } - - public async sendToDevice(conversationId, to, toName, msg) { const options = { - method: 'POST', - url: UrlJoin(this.whatsappServiceUrl, 'message'), - qs: - { - token: this.whatsappServiceKey, - phone: to, - body: msg - }, - headers: - { - 'cache-control': 'no-cache' - } + method: 'POST', + url: UrlJoin(this.whatsappServiceUrl, 'webhook'), + qs: { + token: this.whatsappServiceKey, + webhookUrl: `${this.whatsappServiceWebhookUrl}/instances/${this.botId}/whatsapp`, + set: true + }, + headers: { + 'cache-control': 'no-cache' + } }; - const result = await request.get(options); + try { + const result = await request.post(options); + logger.info(result); + } catch (error) { + logger.error('Error initializing 3rd party Whatsapp provider.', error); + } + + return client; + }) + .catch(err => { + logger.error('Error initializing DirectLine client', err); + }); + } + + public received(req, res) { + const text = req.body.messages[0].body; + const from = req.body.messages[0].author.split('@')[0]; + const fromName = req.body.messages[0].senderName; + + if (req.body.messages[0].fromMe) { + return; // Exit here. } + + logger.info(`GBWhatsapp: Hook called. from: ${from}(${fromName}), text: ${text})`); + + const conversationId = this.conversationIds[from]; + + this.directLineClient.then(client => { + if (this.conversationIds[from] == undefined) { + logger.info(`GBWhatsapp: Starting new conversation on Bot.`); + client.Conversations.Conversations_StartConversation() + .then(response => { + return response.obj.conversationId; + }) + .then(conversationId => { + this.conversationIds[from] = conversationId; + this.inputMessage(client, conversationId, text, from, fromName); + + this.pollMessages(client, conversationId, from, fromName); + }) + .catch(err => { + console.error('Error starting conversation', err); + }); + } else { + this.inputMessage(client, conversationId, text, from, fromName); + } + res.end(); + }); + } + + public inputMessage(client, conversationId, text, from, fromName) { + client.Conversations.Conversations_PostActivity({ + conversationId: conversationId, + activity: { + textFormat: 'plain', + text: text, + type: 'message', + from: { + id: from, + name: fromName + }, + replyToId: from + } + }).catch(err => { + logger.error(`GBWhatsapp: Error receiving message: ${err}.`); + }); + } + + public pollMessages(client, conversationId, from, fromName) { + logger.info(`GBWhatsapp: Starting polling message for conversationId: + ${conversationId}.`); + + setInterval(() => { + client.Conversations.Conversations_GetActivities({ + conversationId: conversationId, + watermark: this.watermark + }) + .then(response => { + this.watermark = response.obj.watermark; + return response.obj.activities; + }) + .then(activities => { + this.printMessages(activities, conversationId, from, fromName); + }); + }, this.pollInterval); + } + + public printMessages(activities, conversationId, from, fromName) { + if (activities && activities.length) { + // Ignore own messages. + + activities = activities.filter(m => m.from.id === 'GeneralBots' && m.type === 'message'); + + if (activities.length) { + // Print other messages. + + activities.forEach(activity => { + this.printMessage(activity, conversationId, from, fromName); + }); + } + } + } + + public printMessage(activity, conversationId, from, fromName) { + let output = ''; + + if (activity.text) { + logger.info(`GBWhatsapp: MSG: ${activity.text}`); + output = activity.text; + } + + if (activity.attachments) { + activity.attachments.forEach(attachment => { + switch (attachment.contentType) { + case 'application/vnd.microsoft.card.hero': + output += `\n${this.renderHeroCard(attachment)}`; + break; + + case 'image/png': + logger.info('Opening the requested image ' + attachment.contentUrl); + output += `\n${attachment.contentUrl}`; + break; + } + }); + } + + this.sendToDevice(from, output); + } + + public renderHeroCard(attachment) { + return `${attachment.content.title} - ${attachment.content.text}`; + } + + public async sendToDevice(to, msg) { + const options = { + method: 'POST', + url: UrlJoin(this.whatsappServiceUrl, 'message'), + qs: { + token: this.whatsappServiceKey, + phone: to, + body: msg + }, + headers: { + 'cache-control': 'no-cache' + } + }; + } } diff --git a/src/app.ts b/src/app.ts index 4fd8ec5d..7b1617c1 100644 --- a/src/app.ts +++ b/src/app.ts @@ -40,7 +40,7 @@ const logger = require('./logger'); const express = require('express'); const bodyParser = require('body-parser'); -import { IGBInstance, IGBPackage } from 'botlib'; +import { IGBInstance, IGBPackage, IGBCoreService } from 'botlib'; import { GBAdminService } from '../packages/admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../packages/azuredeployer.gbapp/services/AzureDeployerService'; import { GuaribasInstance } from '../packages/core.gbapp/models/GBModel'; @@ -50,8 +50,6 @@ 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 { GBVMService } from '../packages/core.gbapp/services/GBVMService'; -import { load } from 'dotenv'; const appPackages = new Array(); @@ -90,7 +88,7 @@ export class GBServer { // Reads basic configuration, initialize minimal services. GBConfigService.init(); - const core = new GBCoreService(); + const core: IGBCoreService = new GBCoreService(); const importer: GBImporter = new GBImporter(core); const deployer: GBDeployer = new GBDeployer(core, importer); @@ -103,7 +101,7 @@ export class GBServer { logger.info(`Establishing a development local proxy (ngrok)...`); const proxyAddress: string = await core.ensureProxy(port); - // Creates a boot instance or load it frmo storage. + // Creates a boot instance or load it from storage. let bootInstance: IGBInstance = null; try { @@ -130,9 +128,9 @@ export class GBServer { 'boot.gbot', 'packages/boot.gbot' ); - const fullInstance = Object.assign(packageInstance, bootInstance); + const fullInstance = { ...packageInstance, ...bootInstance }; await core.saveInstance(fullInstance); - let instances: GuaribasInstance[] = await core.loadAllInstances(core, azureDeployer, proxyAddress); + let instances: IGBInstance[] = await core.loadAllInstances(core, azureDeployer, proxyAddress); instances = await core.ensureInstances(instances, bootInstance, core); if (!bootInstance) { bootInstance = instances[0]; @@ -145,14 +143,13 @@ export class GBServer { // Deployment of local applications for the first time. - deployer.installDefaultGBUI(); + deployer.runOnce(); logger.info(`The Bot Server is in RUNNING mode...`); // Opens Navigator. core.openBrowserInDevelopment(); - } catch (err) { logger.error(`STOP: ${err} ${err.stack ? err.stack : ''}`); process.exit(1); diff --git a/tsconfig.json b/tsconfig.json index 6bc1d011..44e70235 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "resolveJsonModule": true, "outDir": "./dist", "paths": { + "*": ["types/*"], "botlib/*": ["node_modules/botlib/*"], "pragmatismo-io-framework/*": ["node_modules/pragmatismo-io-framework/*"] }, From cd5189d0c81ffc7d8a283c5be96ab349eaf26f89 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 8 Mar 2019 06:49:22 -0300 Subject: [PATCH 19/32] fix(general): tslint being applied in all sources. --- package.json | 1 - packages/admin.gbapp/dialogs/AdminDialog.ts | 3 +- packages/admin.gbapp/models/AdminModel.ts | 4 +-- .../admin.gbapp/services/GBAdminService.ts | 4 ++- .../dialogs/BotFarmDialog.ts | 2 +- .../dialogs/StartDialog.ts | 1 + .../services/AzureDeployerService.ts | 33 ++++++++++--------- packages/console.gblib/index.ts | 2 +- .../services/ConsoleDirectLine.ts | 3 +- packages/core.gbapp/models/GBModel.ts | 2 +- .../core.gbapp/services/GBConfigService.ts | 2 ++ packages/core.gbapp/services/GBCoreService.ts | 4 +++ packages/core.gbapp/services/GBDeployer.ts | 5 +++ .../core.gbapp/services/GBImporterService.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 17 ++++++---- packages/core.gbapp/services/GBVMService.ts | 10 +++--- packages/core.gbapp/services/TSCompiler.ts | 1 - packages/core.gbapp/tests/vm.test.ts | 2 +- .../dialogs/FeedbackDialog.ts | 9 +++-- .../dialogs/QualityDialog.ts | 1 + .../services/CSService.ts | 1 + packages/kb.gbapp/dialogs/AskDialog.ts | 21 +++++++----- packages/kb.gbapp/dialogs/FaqDialog.ts | 2 +- packages/kb.gbapp/dialogs/MenuDialog.ts | 6 ++-- packages/kb.gbapp/services/KBService.ts | 3 +- packages/whatsapp.gblib/index.ts | 2 +- .../services/WhatsappDirectLine.ts | 3 +- src/app.ts | 2 +- 28 files changed, 90 insertions(+), 58 deletions(-) diff --git a/package.json b/package.json index ef8cc94e..f44c5c26 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "ban": "ban", "issues": "git-issues", "license": "license-checker --production --onlyunknown --csv", - "pretslint": "npm run pretty", "pretty": "prettier-standard 'src/*.ts' 'packages/**/*.ts'", "secure": "nsp check", "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";", diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index 724acc5c..21a50978 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -40,12 +40,12 @@ const UrlJoin = require('url-join'); import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBDialog } from 'botlib'; +import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBConfigService } from '../../core.gbapp/services/GBConfigService'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; import { GBImporter } from '../../core.gbapp/services/GBImporterService'; import { GBAdminService } from '../services/GBAdminService'; import { Messages } from '../strings'; -import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; /** * Dialogs for administration tasks. @@ -157,6 +157,7 @@ export class AdminDialog extends IGBDialog { return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'addConnection') { await AdminDialog.addConnectionCommand(min, text); + return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'undeployPackage') { await AdminDialog.undeployPackageCommand(text, min); diff --git a/packages/admin.gbapp/models/AdminModel.ts b/packages/admin.gbapp/models/AdminModel.ts index a747f704..99cd37c4 100644 --- a/packages/admin.gbapp/models/AdminModel.ts +++ b/packages/admin.gbapp/models/AdminModel.ts @@ -39,10 +39,10 @@ import { Column, CreatedAt, + DataType, Model, Table, - UpdatedAt, - DataType + UpdatedAt } from 'sequelize-typescript'; @Table diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index b8db0e5e..68d3a95d 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -37,7 +37,7 @@ 'use strict'; import { AuthenticationContext, TokenResponse } from 'adal-node'; -import { IGBCoreService, IGBAdminService } from 'botlib'; +import { IGBAdminService, IGBCoreService } from 'botlib'; import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; import { GuaribasAdmin } from '../models/AdminModel'; const UrlJoin = require('url-join'); @@ -88,6 +88,7 @@ export class GBAdminService implements IGBAdminService { }; let password = passwordGenerator.generatePassword(options); password = password.replace(/[\@\[\=\:\;\?]/g, '#'); + return password; } @@ -102,6 +103,7 @@ export class GBAdminService implements IGBAdminService { maximumLength: 14 }; const name = passwordGenerator.generatePassword(options); + return name; } diff --git a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts index 96fd56a3..0a41cd43 100644 --- a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts @@ -39,8 +39,8 @@ import { BotAdapter } from 'botbuilder'; import { GBMinInstance } from 'botlib'; import { IGBDialog } from 'botlib'; -import { Messages } from '../strings'; import { WaterfallDialog } from 'botlib/node_modules/botbuilder-dialogs'; +import { Messages } from '../strings'; export class BotFarmDialog extends IGBDialog { /** diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index 8ceade28..4d2175ab 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -136,6 +136,7 @@ export class StartDialog { process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`); password = scanf('%s').replace(/(\n|\r)+$/, ''); } + return password; } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 012e0c95..10cd564a 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -43,7 +43,7 @@ import { SearchManagementClient } from 'azure-arm-search'; import { SqlManagementClient } from 'azure-arm-sql'; import { WebSiteManagementClient } from 'azure-arm-website'; import { AppServicePlan } from 'azure-arm-website/lib/models'; -import { IGBInstance, IGBInstallationDeployer } from 'botlib'; +import { IGBInstallationDeployer, IGBInstance } from 'botlib'; import { HttpMethods, ServiceClient, WebResource } from 'ms-rest-js'; import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; import { GBCorePackage } from '../../../packages/core.gbapp'; @@ -77,6 +77,19 @@ export class AzureDeployerService implements IGBInstallationDeployer { this.deployer = deployer; } + private static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) { + const req = new WebResource(); + req.method = verb; + req.url = url; + req.headers = {}; + req.headers['Content-Type'] = 'application/json'; + req.headers['accept-language'] = '*'; + req.headers.Authorization = 'Bearer ' + accessToken; + req.body = body; + + return req; + } + public async getSubscriptions(credentials) { const subscriptionClient = new SubscriptionClient.default(credentials); @@ -228,19 +241,6 @@ export class AzureDeployerService implements IGBInstallationDeployer { await storageClient.firewallRules.createOrUpdate(groupName, serverName, 'gb', params); } - private static createRequestObject(url: string, accessToken: string, verb: HttpMethods, body: string) { - const req = new WebResource(); - req.method = verb; - req.url = url; - req.headers = {}; - req.headers['Content-Type'] = 'application/json'; - req.headers['accept-language'] = '*'; - req.headers.Authorization = 'Bearer ' + accessToken; - req.body = body; - - return req; - } - public async deployFarm( proxyAddress: string, instance: IGBInstance, @@ -344,6 +344,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { ); spinner.stop(); + return instance; } @@ -385,7 +386,6 @@ export class AzureDeployerService implements IGBInstallationDeployer { this.accessToken = credentials.tokenCache._entries[0].accessToken; } - private async createStorageServer(group, name, administratorLogin, administratorPassword, serverName, location) { const params = { location: location, @@ -471,6 +471,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const res = await httpClient.sendRequest(req); if (!(res.bodyAsJson as any).id) { reject(res.bodyAsText); + return; } @@ -588,6 +589,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { private async createDeployGroup(name, location) { const params = { location: location }; + return this.resourceClient.resourceGroups.createOrUpdate(name, params); } @@ -610,6 +612,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { location: location, serverFarmId: farmId }; + return this.webSiteClient.webApps.createOrUpdate(group, name, parameters); } } diff --git a/packages/console.gblib/index.ts b/packages/console.gblib/index.ts index e056b050..35fd8129 100644 --- a/packages/console.gblib/index.ts +++ b/packages/console.gblib/index.ts @@ -44,7 +44,7 @@ import { Sequelize } from 'sequelize-typescript'; import { ConsoleDirectLine } from './services/ConsoleDirectLine'; export class GBConsolePackage implements IGBPackage { - + public sysPackages: IGBPackage[] = undefined; public channel: ConsoleDirectLine; public getDialogs(min: GBMinInstance) {} diff --git a/packages/console.gblib/services/ConsoleDirectLine.ts b/packages/console.gblib/services/ConsoleDirectLine.ts index 9cf41844..ede2e837 100644 --- a/packages/console.gblib/services/ConsoleDirectLine.ts +++ b/packages/console.gblib/services/ConsoleDirectLine.ts @@ -64,6 +64,7 @@ export class ConsoleDirectLine extends GBService { .then(function (client) { client.clientAuthorizations.add('AuthorizationBotConnector', new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header')); + return client; }) .catch(function (err) { @@ -129,7 +130,7 @@ export class ConsoleDirectLine extends GBService { setInterval(function () { client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark }) .then(function (response) { - watermark = response.obj.watermark; // use watermark so subsequent requests skip old messages + watermark = response.obj.watermark; return response.obj.activities; }) .then(_this_.printMessages, _this_.directLineClientName); diff --git a/packages/core.gbapp/models/GBModel.ts b/packages/core.gbapp/models/GBModel.ts index a382b92b..cf1dac68 100644 --- a/packages/core.gbapp/models/GBModel.ts +++ b/packages/core.gbapp/models/GBModel.ts @@ -54,7 +54,7 @@ import { IGBInstance } from 'botlib'; @Table export class GuaribasInstance extends Model implements IGBInstance { - + @PrimaryKey @AutoIncrement @Column diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index e6be5c2d..e0a6fd65 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -112,6 +112,7 @@ export class GBConfigService { break; } } + return value; } @@ -120,6 +121,7 @@ export class GBConfigService { if (!value) { value = process.env[key]; } + return value; } } diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index eefef487..72c0c1b2 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -420,10 +420,12 @@ STORAGE_SYNC=true fkname += '_' + matches[1]; matches = re4.exec(fkcols); } + return 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')'; } ); } + return sql; } @@ -453,10 +455,12 @@ STORAGE_SYNC=true fkname += '_' + matches[1]; matches = re3.exec(fkcols); } + return (args[0] ? args[0] : '') + 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')'; } ); } + return sql; } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index b526a48b..b75c49ea 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -224,6 +224,7 @@ export class GBDeployer { // PACKAGE: Put in package logic. case '.gbkb': const service = new KBService(this.core.sequelize); + return service.deployKb(this.core, this, localPath); case '.gbui': @@ -231,6 +232,7 @@ export class GBDeployer { case '.gbdialog': const vm = new GBVMService(); + return vm.loadDialogPackage(localPath, min, this.core, this); default: @@ -257,6 +259,7 @@ export class GBDeployer { case '.gbkb': const service = new KBService(this.core.sequelize); + return service.undeployKbFromStorage(instance, this, p.packageId); case '.gbui': @@ -307,6 +310,7 @@ export class GBDeployer { public async getPackageByName(instanceId: number, packageName: string): Promise { const where = { packageName: packageName, instanceId: instanceId }; + return GuaribasPackage.findOne({ where: where }); @@ -436,6 +440,7 @@ export class GBDeployer { appPackagesProcessed++; } }); + return appPackagesProcessed; } } diff --git a/packages/core.gbapp/services/GBImporterService.ts b/packages/core.gbapp/services/GBImporterService.ts index 65745089..9464d60b 100644 --- a/packages/core.gbapp/services/GBImporterService.ts +++ b/packages/core.gbapp/services/GBImporterService.ts @@ -69,7 +69,7 @@ export class GBImporter { packageJson = { ...packageJson, ...settings, ...servicesJson }; - if (botId){ + if (botId) { packageJson.botId = botId; } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 738b942a..6722f8c8 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -46,7 +46,7 @@ const AuthenticationContext = require('adal-node').AuthenticationContext; import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder'; import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBPackage, IGBInstance } from 'botlib'; +import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; import { GBAnalyticsPackage } from '../../analytics.gblib'; import { GBCorePackage } from '../../core.gbapp'; import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp'; @@ -266,11 +266,13 @@ export class GBMinService { try { const json = await request(options); + return Promise.resolve(JSON.parse(json)); } catch (error) { const msg = `[botId:${ instance.botId }] Error calling Direct Line client, verify Bot endpoint on the cloud. Error is: ${error}.`; + return Promise.reject(new Error(msg)); } } @@ -296,6 +298,7 @@ export class GBMinService { return await request(options); } catch (error) { const msg = `Error calling Speech to Text client. Error is: ${error}.`; + return Promise.reject(new Error(msg)); } } @@ -351,21 +354,21 @@ export class GBMinService { if (sysPackage.name === 'GBWhatsappPackage') { const url = '/instances/:botId/whatsapp'; server.post(url, (req, res) => { - p['channel'].received(req, res); + p.channel.received(req, res); }); } - }, this); + }, this); appPackages.forEach(p => { p.sysPackages = sysPackages; p.loadBot(min); if (p.getDialogs !== undefined) { - let dialogs = p.getDialogs(min); + const dialogs = p.getDialogs(min); dialogs.forEach(dialog => { min.dialogs.add(new WaterfallDialog(dialog.name, dialog.waterfall)); }); } - }, this); + }, this); } /** @@ -476,10 +479,10 @@ export class GBMinService { private async processMessageActivity(context, min: GBMinInstance, step: any) { // Direct script invoking by itent name. - let isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined; + const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined; if (isVMCall) { - let mainMethod = context.activity.text; + const mainMethod = context.activity.text; min.sandBoxMap[mainMethod].context = context; min.sandBoxMap[mainMethod].step = step; diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index 40a7afff..8690a607 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -33,19 +33,19 @@ 'use strict'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance, IGBCoreService, GBService } from 'botlib'; +import { GBMinInstance, GBService, IGBCoreService } from 'botlib'; import * as fs from 'fs'; +import GBAPIService from './GBAPIService'; +import GBAPIService from './GBAPIService'; import { GBDeployer } from './GBDeployer'; import { TSCompiler } from './TSCompiler'; -import GBAPIService from './GBAPIService'; -import DialogClass from './GBAPIService'; const walkPromise = require('walk-promise'); const logger = require('../../../src/logger'); const vm = require('vm'); const UrlJoin = require('url-join'); const vb2ts = require('vbscript-to-typescript/dist/converter'); -let beautify = require('js-beautify').js; +const beautify = require('js-beautify').js; /** * @fileoverview Virtualization services for emulation of BASIC. @@ -250,7 +250,7 @@ export class GBVMService extends GBService { min.dialogs.add( new WaterfallDialog('/hear', [ async step => { - step.activeDialog.state.cbId = step.options['id']; + step.activeDialog.state.cbId = step.options.id; return await step.prompt('textPrompt', {}); }, diff --git a/packages/core.gbapp/services/TSCompiler.ts b/packages/core.gbapp/services/TSCompiler.ts index 2b6a2cb0..942e82b0 100644 --- a/packages/core.gbapp/services/TSCompiler.ts +++ b/packages/core.gbapp/services/TSCompiler.ts @@ -41,7 +41,6 @@ const logger = require('../../../src/logger'); export class TSCompiler { - private static shouldIgnoreError(diagnostic) { const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); diff --git a/packages/core.gbapp/tests/vm.test.ts b/packages/core.gbapp/tests/vm.test.ts index 39e4bca5..1be437b2 100644 --- a/packages/core.gbapp/tests/vm.test.ts +++ b/packages/core.gbapp/tests/vm.test.ts @@ -44,7 +44,7 @@ describe('Load function', () => { try { // const service = new GBVMService(); // TODO: service.loadJS('invalid.file', null, null, null, null); - + } catch (error) { expect(error).to.equal(0); } diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index d0ee93c3..e66d26e7 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -58,6 +58,7 @@ export class FeedbackDialog extends IGBDialog { new WaterfallDialog('/feedbackNumber', [ async step => { const locale = step.context.activity.locale; + // TODO: Migrate to 4.*+ await step.prompt("choicePrompt", Messages[locale].what_about_me, [ // "1", // "2", @@ -73,6 +74,7 @@ export class FeedbackDialog extends IGBDialog { const user = await min.userProfile.get(context, {}); await service.updateConversationRate(user.conversation, rate); await step.context.sendActivity(Messages[locale].thanks); + return await step.next(); } ]) @@ -84,7 +86,7 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].about_suggestions); - step.activeDialog.state.cbId = step.options['id']; + step.activeDialog.state.cbId = step.options.id; return await step.prompt('textPrompt', Messages[locale].what_about_service); }, @@ -93,8 +95,8 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; const rate = await AzureText.getSentiment( min.instance.textAnalyticsKey, - min.instance.textAnalyticsEndpoint, - min.conversationalService.getCurrentLanguage(step), + min.instance.textAnalyticsEndpoint, + min.conversationalService.getCurrentLanguage(step), step.result ); @@ -105,6 +107,7 @@ export class FeedbackDialog extends IGBDialog { // TODO: Record. } + return await step.replaceDialog('/ask', { isReturning: true }); } diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index dbfaf596..186259fe 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -79,6 +79,7 @@ export class QualityDialog extends IGBDialog { ); await step.replaceDialog('/ask', { isReturning: true }); } + return await step.next(); } ])); diff --git a/packages/customer-satisfaction.gbapp/services/CSService.ts b/packages/customer-satisfaction.gbapp/services/CSService.ts index 959843e6..0a8b424c 100644 --- a/packages/customer-satisfaction.gbapp/services/CSService.ts +++ b/packages/customer-satisfaction.gbapp/services/CSService.ts @@ -62,6 +62,7 @@ export class CSService { rate: number ): Promise { conversation.rate = rate; + return conversation.save(); } } diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index 5d7bfa34..f517a96c 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -59,8 +59,8 @@ export class AskDialog extends IGBDialog { min.dialogs.add( new WaterfallDialog('/answerEvent', [ async step => { - if (step.options && step.options['questionId']) { - const question = await service.getQuestionById(min.instance.instanceId, step.options['questionId']); + if (step.options && step.options.questionId) { + const question = await service.getQuestionById(min.instance.instanceId, step.options.questionId); const answer = await service.getAnswerById(min.instance.instanceId, question.answerId); // Sends the answer to all outputs, including projector. @@ -69,6 +69,7 @@ export class AskDialog extends IGBDialog { await step.replaceDialog('/ask', { isReturning: true }); } + return await step.next(); } ]) @@ -78,7 +79,7 @@ export class AskDialog extends IGBDialog { new WaterfallDialog('/answer', [ async step => { const user = await min.userProfile.get(step.context, {}); - let text = step.options['query']; + let text = step.options.query; if (!text) { throw new Error(`/answer being called with no args query text.`); } @@ -91,9 +92,9 @@ export class AskDialog extends IGBDialog { // Handle extra text from FAQ. - if (step.options && step.options['query']) { - text = step.options['query']; - } else if (step.options && step.options['fromFaq']) { + if (step.options && step.options.query) { + text = step.options.query; + } else if (step.options && step.options.fromFaq) { await step.context.sendActivity(Messages[locale].going_answer); } @@ -155,10 +156,12 @@ export class AskDialog extends IGBDialog { // Sends the answer to all outputs, including projector. await service.sendAnswer(min.conversationalService, step, resultsB.answer); + return await step.replaceDialog('/ask', { isReturning: true }); } else { if (!(await min.conversationalService.routeNLP(step, min, text))) { await step.context.sendActivity(Messages[locale].did_not_find); + return await step.replaceDialog('/ask', { isReturning: true }); } } @@ -180,9 +183,9 @@ export class AskDialog extends IGBDialog { // Three forms of asking. - if (step.options && step.options['firstTime']) { + if (step.options && step.options.firstTime) { text = Messages[locale].ask_first_time; - } else if (step.options && step.options['isReturning']) { + } else if (step.options && step.options.isReturning) { text = Messages[locale].anything_else; } else if (user.subjects.length > 0) { text = Messages[locale].which_question; @@ -193,6 +196,7 @@ export class AskDialog extends IGBDialog { if (text.length > 0) { return await step.prompt('textPrompt', text); } + return await step.next(); }, async step => { @@ -205,6 +209,5 @@ export class AskDialog extends IGBDialog { ]) ); - } } diff --git a/packages/kb.gbapp/dialogs/FaqDialog.ts b/packages/kb.gbapp/dialogs/FaqDialog.ts index 69bf1839..142a0c14 100644 --- a/packages/kb.gbapp/dialogs/FaqDialog.ts +++ b/packages/kb.gbapp/dialogs/FaqDialog.ts @@ -64,7 +64,7 @@ export class FaqDialog extends IGBDialog { data: data.slice(0, 10) }); - await step.context.sendActivity(Messages[locale].see_faq); // TODO: RND messages. + await step.context.sendActivity(Messages[locale].see_faq); return await step.next(); } } diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts index 62c0293d..0d34eaa5 100644 --- a/packages/kb.gbapp/dialogs/MenuDialog.ts +++ b/packages/kb.gbapp/dialogs/MenuDialog.ts @@ -63,8 +63,8 @@ export class MenuDialog extends IGBDialog { const locale = step.context.activity.locale; let rootSubjectId = null; - if (step.options && step.options['data']) { - const subject = step.options['data']; + if (step.options && step.options.data) { + const subject = step.options.data; // If there is a shortcut specified as subject destination, go there. @@ -72,6 +72,7 @@ export class MenuDialog extends IGBDialog { const dialog = subject.to.split(':')[1]; await step.replaceDialog('/' + dialog); await step.endDialog(); + return; } @@ -156,6 +157,7 @@ export class MenuDialog extends IGBDialog { const user = await min.userProfile.get(step.context, {}); user.isAsking = true; + return await step.next(); } ])); diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index fc47a0e4..c81113d6 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -49,11 +49,11 @@ import { Messages } from '../strings'; import { IGBConversationalService, IGBCoreService, IGBInstance } from 'botlib'; import { AzureSearch } from 'pragmatismo-io-framework'; import { Sequelize } from 'sequelize-typescript'; +import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GuaribasPackage } from '../../core.gbapp/models/GBModel'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from '../models'; import { GBConfigService } from './../../core.gbapp/services/GBConfigService'; -import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; export class KBServiceSearchResults { public answer: GuaribasAnswer; @@ -433,6 +433,7 @@ export class KBService { } }); }; + return doIt(subjects.children, null); } diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts index ea79e0d1..4f06006e 100644 --- a/packages/whatsapp.gblib/index.ts +++ b/packages/whatsapp.gblib/index.ts @@ -45,9 +45,9 @@ import { WhatsappDirectLine } from './services/WhatsappDirectLine'; export class GBWhatsappPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} public channel: WhatsappDirectLine; + public getDialogs(min: GBMinInstance) {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 0344b352..4c5506a6 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -142,12 +142,13 @@ export class WhatsappDirectLine extends GBService { }) .then(response => { this.watermark = response.obj.watermark; + return response.obj.activities; }) .then(activities => { this.printMessages(activities, conversationId, from, fromName); }); - }, this.pollInterval); + }, this.pollInterval); } public printMessages(activities, conversationId, from, fromName) { diff --git a/src/app.ts b/src/app.ts index 7b1617c1..7a1750fd 100644 --- a/src/app.ts +++ b/src/app.ts @@ -40,7 +40,7 @@ const logger = require('./logger'); const express = require('express'); const bodyParser = require('body-parser'); -import { IGBInstance, IGBPackage, IGBCoreService } from 'botlib'; +import { IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; import { GBAdminService } from '../packages/admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../packages/azuredeployer.gbapp/services/AzureDeployerService'; import { GuaribasInstance } from '../packages/core.gbapp/models/GBModel'; From 2c185177a8ceee30e4e29513daefd9ef5ef0566c Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 8 Mar 2019 17:05:58 -0300 Subject: [PATCH 20/32] fix(general): tslint being applied in all sources. --- package.json | 2 +- packages/admin.gbapp/index.ts | 2 +- packages/analytics.gblib/index.ts | 2 +- packages/azuredeployer.gbapp/index.ts | 2 +- .../services/AzureDeployerService.ts | 22 +- packages/console.gblib/index.ts | 2 +- .../services/ConsoleDirectLine.ts | 303 ++++++++---------- packages/core.gbapp/dialogs/WhoAmIDialog.ts | 2 +- packages/core.gbapp/index.ts | 2 +- .../core.gbapp/services/GBConfigService.ts | 4 +- .../services/GBConversationalService.ts | 42 ++- packages/core.gbapp/services/GBCoreService.ts | 98 +++--- packages/core.gbapp/services/GBDeployer.ts | 42 +-- packages/core.gbapp/services/GBMinService.ts | 28 +- packages/core.gbapp/services/GBVMService.ts | 11 +- packages/core.gbapp/services/TSCompiler.ts | 6 +- .../dialogs/FeedbackDialog.ts | 2 +- .../dialogs/QualityDialog.ts | 4 +- packages/customer-satisfaction.gbapp/index.ts | 2 +- packages/kb.gbapp/dialogs/AskDialog.ts | 14 +- packages/kb.gbapp/dialogs/FaqDialog.ts | 5 +- packages/kb.gbapp/dialogs/MenuDialog.ts | 2 +- packages/kb.gbapp/index.ts | 2 +- packages/kb.gbapp/services/KBService.ts | 18 +- packages/security.gblib/index.ts | 2 +- packages/whatsapp.gblib/index.ts | 2 +- .../services/WhatsappDirectLine.ts | 20 +- src/app.ts | 14 +- src/logger.ts | 76 ----- tslint.json | 79 +++-- 30 files changed, 357 insertions(+), 455 deletions(-) delete mode 100644 src/logger.ts diff --git a/package.json b/package.json index f44c5c26..810157d2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "scripts": { "clean": "shx rm -rf node_modules/ dist/ docs/reference", - "tslint": "tslint --fix ./src/*.ts ./packages/**/*.ts -t verbose", + "tslint": "tslint --fix ./src/*.ts ./packages/**/*.ts -t verbose -e ./packages/default.gbui/**/* -e ./packages/**/*.gbdialog/**/*", "build": "npm install && npm run build-server && npm run build-gbui && npm run build-docs", "build-server": "tsc", "build-gbui": "cd packages/default.gbui && echo SKIP_PREFLIGHT_CHECK=true >.env && npm install && npm run build", diff --git a/packages/admin.gbapp/index.ts b/packages/admin.gbapp/index.ts index d3c5aef7..802fa41b 100644 --- a/packages/admin.gbapp/index.ts +++ b/packages/admin.gbapp/index.ts @@ -47,7 +47,7 @@ export class GBAdminPackage implements IGBPackage { public unloadPackage(core: IGBCoreService): void {} public getDialogs(min: GBMinInstance) {} public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasAdmin]); diff --git a/packages/analytics.gblib/index.ts b/packages/analytics.gblib/index.ts index 3e0860b4..0c3e33f8 100644 --- a/packages/analytics.gblib/index.ts +++ b/packages/analytics.gblib/index.ts @@ -49,5 +49,5 @@ export class GBAnalyticsPackage implements IGBPackage { public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void {} public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/azuredeployer.gbapp/index.ts b/packages/azuredeployer.gbapp/index.ts index 66d85906..905b43cd 100644 --- a/packages/azuredeployer.gbapp/index.ts +++ b/packages/azuredeployer.gbapp/index.ts @@ -50,5 +50,5 @@ export class GBAzureDeployerPackage implements IGBPackage { public loadBot(min: GBMinInstance): void {} public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 10cd564a..c0584c00 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -51,7 +51,7 @@ import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigS import { GBDeployer } from '../../../packages/core.gbapp/services/GBDeployer'; const Spinner = require('cli-spinner').Spinner; -const logger = require('../../../src/logger'); + const UrlJoin = require('url-join'); const iconUrl = 'https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-logo-squared.png'; const publicIp = require('public-ip'); @@ -221,7 +221,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { if (!(res.bodyAsJson as any).id) { throw res.bodyAsText; } - logger.info(`Bot proxy updated at: ${endpoint}.`); + GBLog.info(`Bot proxy updated at: ${endpoint}.`); } public async openStorageFirewall(groupName, serverName) { @@ -258,14 +258,14 @@ export class AzureDeployerService implements IGBInstallationDeployer { let keys: any; const name = instance.botId; - logger.info(`Deploying Deploy Group (It may take a few minutes)...`); + GBLog.info(`Deploying Deploy Group (It may take a few minutes)...`); await this.createDeployGroup(name, instance.cloudLocation); - logger.info(`Deploying Bot Server...`); + GBLog.info(`Deploying Bot Server...`); const serverFarm = await this.createHostingPlan(name, `${name}-server-plan`, instance.cloudLocation); await this.createServer(serverFarm.id, name, `${name}-server`, instance.cloudLocation); - logger.info(`Deploying Bot Storage...`); + GBLog.info(`Deploying Bot Storage...`); const administratorLogin = `sa${GBAdminService.getRndReadableIdentifier()}`; const administratorPassword = GBAdminService.getRndPassword(); const storageServer = `${name.toLowerCase()}-storage-server`; @@ -285,7 +285,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { instance.storageDialect = 'mssql'; instance.storageServer = storageServer; - logger.info(`Deploying Search...`); + GBLog.info(`Deploying Search...`); const searchName = `${name}-search`.toLowerCase(); await this.createSearch(name, searchName, instance.cloudLocation); const searchKeys = await this.searchClient.adminKeys.get(name, searchName); @@ -295,19 +295,19 @@ export class AzureDeployerService implements IGBInstallationDeployer { instance.searchKey = searchKeys.primaryKey; this.deployer.rebuildIndex(instance, this.deployer); - logger.info(`Deploying Speech...`); + GBLog.info(`Deploying Speech...`); const speech = await this.createSpeech(name, `${name}-speech`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, speech.name); instance.speechEndpoint = speech.endpoint; instance.speechKey = keys.key1; - logger.info(`Deploying SpellChecker...`); + GBLog.info(`Deploying SpellChecker...`); const spellChecker = await this.createSpellChecker(name, `${name}-spellchecker`); keys = await this.cognitiveClient.accounts.listKeys(name, spellChecker.name); instance.spellcheckerKey = keys.key1; instance.spellcheckerEndpoint = spellChecker.endpoint; - logger.info(`Deploying Text Analytics...`); + GBLog.info(`Deploying Text Analytics...`); const textAnalytics = await this.createTextAnalytics(name, `${name}-textanalytics`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, textAnalytics.name); instance.textAnalyticsEndpoint = textAnalytics.endpoint; @@ -315,7 +315,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { // TODO: Check quotes being added when NLP field is filled. - logger.info(`Deploying NLP...`); + GBLog.info(`Deploying NLP...`); const nlp = await this.createNLP(name, `${name}-nlp`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, nlp.name); const nlpAppId = await this.createNLPService(name, name, instance.cloudLocation, culture, instance.nlpAuthoringKey); @@ -324,7 +324,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { instance.nlpKey = keys.key1; instance.nlpAppId = nlpAppId; - logger.info(`Deploying Bot...`); + GBLog.info(`Deploying Bot...`); instance.botEndpoint = this.defaultEndPoint; instance = await this.internalDeployBot( diff --git a/packages/console.gblib/index.ts b/packages/console.gblib/index.ts index 35fd8129..1ee62f9a 100644 --- a/packages/console.gblib/index.ts +++ b/packages/console.gblib/index.ts @@ -59,5 +59,5 @@ export class GBConsolePackage implements IGBPackage { public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/console.gblib/services/ConsoleDirectLine.ts b/packages/console.gblib/services/ConsoleDirectLine.ts index ede2e837..56be12e8 100644 --- a/packages/console.gblib/services/ConsoleDirectLine.ts +++ b/packages/console.gblib/services/ConsoleDirectLine.ts @@ -1,193 +1,152 @@ -/*****************************************************************************\ -| ( )_ _ | -| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | -| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | -| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | -| | | ( )_) | | -| (_) \___/' | -| | -| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | -| Licensed under the AGPL-3.0. | -| | -| According to our dual licensing model, this program can be used either | -| under the terms of the GNU Affero General Public License, version 3, | -| or under a proprietary license. | -| | -| The texts of the GNU Affero General Public License with an additional | -| permission and of our proprietary license can be found at and | -| in the LICENSE file you have received along with this program. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY, without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Affero General Public License for more details. | -| | -| "General Bots" is a registered trademark of Pragmatismo.io. | -| The licensing of the program under the AGPLv3 does not imply a | -| trademark license. Therefore any rights, title and interest in | -| our trademarks remain entirely with us. | -| | -\*****************************************************************************/ - -const Path = require('path'); -const Fs = require('fs'); -const _ = require('lodash'); -const Parse = require('csv-parse'); -const Async = require('async'); -const UrlJoin = require('url-join'); -const logger = require('../../../src/logger'); const Swagger = require('swagger-client'); const rp = require('request-promise'); import { GBService } from 'botlib'; export class ConsoleDirectLine extends GBService { + public pollInterval = 1000; + public directLineSecret = ''; + public directLineClientName = 'DirectLineClient'; + public directLineSpecUrl = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json'; - public pollInterval = 1000; - public directLineSecret = ''; - public directLineClientName = 'DirectLineClient'; - public directLineSpecUrl = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json'; + constructor(directLineSecret) { + super(); - constructor(directLineSecret) { - super(); + this.directLineSecret = directLineSecret; - this.directLineSecret = directLineSecret; - - // TODO: Migrate to Swagger 3. - const directLineClient = rp(this.directLineSpecUrl) - .then(function (spec) { - return new Swagger({ - spec: JSON.parse(spec.trim()), - usePromise: true - }); - }) - .then(function (client) { - client.clientAuthorizations.add('AuthorizationBotConnector', - new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header')); - - return client; - }) - .catch(function (err) { - console.error('Error initializing DirectLine client', err); - }); - - // TODO: Remove *this* issue. - const _this_ = this; - directLineClient.then((client) => { - client.Conversations.Conversations_StartConversation() - .then(function (response) { - return response.obj.conversationId; - }) - .then(function (conversationId) { - _this_.sendMessagesFromConsole(client, conversationId); - _this_.pollMessages(client, conversationId); - }) - .catch(function (err) { - console.error('Error starting conversation', err); - }); + const directLineClient = rp(this.directLineSpecUrl) + .then(function(spec) { + return new Swagger({ + spec: JSON.parse(spec.trim()), + usePromise: true + }); + }) + .then(function(client) { + client.clientAuthorizations.add( + 'AuthorizationBotConnector', + new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header') + ); + + return client; + }) + .catch(function(err) { + console.error('Error initializing DirectLine client', err); + }); + + // TODO: Remove *this* issue. + const _this_ = this; + directLineClient.then(client => { + client.Conversations.Conversations_StartConversation() + .then(function(response) { + return response.obj.conversationId; + }) + .then(function(conversationId) { + _this_.sendMessagesFromConsole(client, conversationId); + _this_.pollMessages(client, conversationId); + }) + .catch(function(err) { + console.error('Error starting conversation', err); + }); + }); + } + + public sendMessagesFromConsole(client, conversationId) { + const _this_ = this; + process.stdin.resume(); + const stdin = process.stdin; + process.stdout.write('Command> '); + stdin.addListener('data', function(e) { + const input = e.toString().trim(); + if (input) { + // exit + if (input.toLowerCase() === 'exit') { + return process.exit(); + } + + client.Conversations.Conversations_PostActivity({ + conversationId: conversationId, + activity: { + textFormat: 'plain', + text: input, + type: 'message', + from: { + id: _this_.directLineClientName, + name: _this_.directLineClientName + } + } + }).catch(function(err) { + console.error('Error sending message:', err); }); - } - public sendMessagesFromConsole(client, conversationId) { - const _this_ = this; - process.stdin.resume(); - const stdin = process.stdin; process.stdout.write('Command> '); - stdin.addListener('data', function (e) { - const input = e.toString().trim(); - if (input) { - // exit - if (input.toLowerCase() === 'exit') { - return process.exit(); - } + } + }); + } - client.Conversations.Conversations_PostActivity( - { - conversationId: conversationId, - activity: { - textFormat: 'plain', - text: input, - type: 'message', - from: { - id: _this_.directLineClientName, - name: _this_.directLineClientName - } - } - }).catch(function (err) { - console.error('Error sending message:', err); - }); + /** TBD: Poll Messages from conversation using DirectLine client */ + public pollMessages(client, conversationId) { + const _this_ = this; + console.log('Starting polling message for conversationId: ' + conversationId); + let watermark = null; + setInterval(function() { + client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark }) + .then(function(response) { + watermark = response.obj.watermark; - process.stdout.write('Command> '); - } - }); + return response.obj.activities; + }) + .then(_this_.printMessages, _this_.directLineClientName); + }, this.pollInterval); + } + + public printMessages(activities, directLineClientName) { + if (activities && activities.length) { + // ignore own messages + activities = activities.filter(function(m) { + return m.from.id !== directLineClientName; + }); + + if (activities.length) { + // print other messages + activities.forEach(activity => { + console.log(activity.text); + }, this); + + process.stdout.write('Command> '); + } + } + } + + public printMessage(activity) { + if (activity.text) { + console.log(activity.text); } - /** TBD: Poll Messages from conversation using DirectLine client */ - public pollMessages(client, conversationId) { - const _this_ = this; - console.log('Starting polling message for conversationId: ' + conversationId); - let watermark = null; - setInterval(function () { - client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark }) - .then(function (response) { - watermark = response.obj.watermark; - return response.obj.activities; - }) - .then(_this_.printMessages, _this_.directLineClientName); - }, this.pollInterval); - } + if (activity.attachments) { + activity.attachments.forEach(function(attachment) { + switch (attachment.contentType) { + case 'application/vnd.microsoft.card.hero': + this.renderHeroCard(attachment); + break; - public printMessages(activities, directLineClientName) { - - if (activities && activities.length) { - // ignore own messages - activities = activities.filter(function (m) { return m.from.id !== directLineClientName; }); - - if (activities.length) { - - // print other messages - activities.forEach(activity => { - console.log(activity.text); - }, this); - - process.stdout.write('Command> '); - } + case 'image/png': + console.log('Opening the requested image ' + attachment.contentUrl); + open(attachment.contentUrl); + break; } + }); } + } - public printMessage(activity) { - if (activity.text) { - console.log(activity.text); - } + public renderHeroCard(attachment) { + const width = 70; + const contentLine = function(content) { + return ' '.repeat((width - content.length) / 2) + content + ' '.repeat((width - content.length) / 2); + }; - if (activity.attachments) { - activity.attachments.forEach(function (attachment) { - switch (attachment.contentType) { - case 'application/vnd.microsoft.card.hero': - this.renderHeroCard(attachment); - break; - - case 'image/png': - console.log('Opening the requested image ' + attachment.contentUrl); - open(attachment.contentUrl); - break; - } - }); - } - } - - public renderHeroCard(attachment) { - const width = 70; - const contentLine = function (content) { - return ' '.repeat((width - content.length) / 2) + - content + - ' '.repeat((width - content.length) / 2); - }; - - console.log('/' + '*'.repeat(width + 1)); - console.log('*' + contentLine(attachment.content.title) + '*'); - console.log('*' + ' '.repeat(width) + '*'); - console.log('*' + contentLine(attachment.content.text) + '*'); - console.log('*'.repeat(width + 1) + '/'); - } + console.log('/' + '*'.repeat(width + 1)); + console.log('*' + contentLine(attachment.content.title) + '*'); + console.log('*' + ' '.repeat(width) + '*'); + console.log('*' + contentLine(attachment.content.text) + '*'); + console.log('*'.repeat(width + 1) + '/'); + } } diff --git a/packages/core.gbapp/dialogs/WhoAmIDialog.ts b/packages/core.gbapp/dialogs/WhoAmIDialog.ts index 20d7162e..7b20eddc 100644 --- a/packages/core.gbapp/dialogs/WhoAmIDialog.ts +++ b/packages/core.gbapp/dialogs/WhoAmIDialog.ts @@ -57,7 +57,7 @@ export class WhoAmIDialog extends IGBDialog { if (min.instance.whoAmIVideo) { await step.context.sendActivity(Messages[locale].show_video); - await min.conversationalService.sendEvent(step, 'play', { + await min.conversationalService.sendEvent(step: GBDialogStep, 'play', { playerType: 'video', data: min.instance.whoAmIVideo.trim() }); diff --git a/packages/core.gbapp/index.ts b/packages/core.gbapp/index.ts index 7166bfa6..3e73cba4 100644 --- a/packages/core.gbapp/index.ts +++ b/packages/core.gbapp/index.ts @@ -63,5 +63,5 @@ export class GBCorePackage implements IGBPackage { } public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index e0a6fd65..e3e58e0e 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -30,7 +30,7 @@ | | \*****************************************************************************/ -const logger = require('../../../src/logger'); + import * as fs from 'fs'; /** @@ -108,7 +108,7 @@ export class GBConfigService { value = 'true'; break; default: - logger.warn(`Invalid key on .env file: '${key}'`); + GBLog.warn(`Invalid key on .env file: '${key}'`); break; } } diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 3c83c608..5d4e501a 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -36,13 +36,11 @@ 'use strict'; -const logger = require('../../../src/logger'); -import { MessageFactory } from 'botbuilder'; +import { MessageFactory, RecognizerResult } from 'botbuilder'; import { LuisRecognizer } from 'botbuilder-ai'; -import { GBMinInstance, IGBConversationalService, IGBCoreService } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBConversationalService, IGBCoreService } from 'botlib'; import { AzureText } from 'pragmatismo-io-framework'; import { Messages } from '../strings'; -import { GBCoreService } from './GBCoreService'; const Nexmo = require('nexmo'); export interface LanguagePickerSettings { @@ -50,19 +48,22 @@ export interface LanguagePickerSettings { supportedLocales?: string[]; } +/** + * Provides basic services for handling messages and dispatching to back-end + * services like NLP or Search. + */ export class GBConversationalService implements IGBConversationalService { - public coreService: IGBCoreService; constructor(coreService: IGBCoreService) { this.coreService = coreService; } - public getCurrentLanguage(step: any) { + public getCurrentLanguage(step: GBDialogStep) { return step.context.activity.locale; } - public async sendEvent(step: any, name: string, value: any): Promise { + public async sendEvent(step: GBDialogStep, name: string, value: any): Promise { if (step.context.activity.channelId === 'webchat') { const msg = MessageFactory.text(''); msg.value = value; @@ -73,6 +74,7 @@ export class GBConversationalService implements IGBConversationalService { } } + // tslint:disable:no-unsafe-any due to Nexmo. public async sendSms(min: GBMinInstance, mobile: string, text: string): Promise { return new Promise( (resolve: any, reject: any): any => { @@ -80,6 +82,7 @@ export class GBConversationalService implements IGBConversationalService { apiKey: min.instance.smsKey, apiSecret: min.instance.smsSecret }); + // tslint:disable-next-line:no-unsafe-any nexmo.message.sendSms(min.instance.smsServiceNumber, mobile, text, (err, data) => { if (err) { reject(err); @@ -90,8 +93,9 @@ export class GBConversationalService implements IGBConversationalService { } ); } + // tslint:enable:no-unsafe-any - public async routeNLP(step: any, min: GBMinInstance, text: string): Promise { + public async routeNLP(step: GBDialogStep, min: GBMinInstance, text: string): Promise { // Invokes LUIS. const endpoint = min.instance.nlpEndpoint.replace('/luis/v2.0', ''); @@ -102,38 +106,42 @@ export class GBConversationalService implements IGBConversationalService { endpoint: endpoint }); - let nlp: any; + let nlp: RecognizerResult; try { nlp = await model.recognize(step.context); } catch (error) { + // tslint:disable:no-unsafe-any if (error.statusCode === 404) { - logger.warn('NLP application still not publish and there are no other options for answering.'); + GBLog.warn('NLP application still not publish and there are no other options for answering.'); return Promise.resolve(false); } else { const msg = `Error calling NLP, check if you have a published model and assigned keys. Error: ${ error.statusCode ? error.statusCode : '' - } ${error.message}`; + } {error.message; }`; return Promise.reject(new Error(msg)); } + // tslint:enable:no-unsafe-any } // Resolves intents returned from LUIS. const topIntent = LuisRecognizer.topIntent(nlp); - if (topIntent) { + if (topIntent !== undefined) { const intent = topIntent; - const entity = nlp.entities && nlp.entities.length > 0 ? nlp.entities[0].entity.toUpperCase() : null; + // tslint:disable:no-unsafe-any + const firstEntity = nlp.entities && nlp.entities.length > 0 ? nlp.entities[0].entity.toUpperCase() : undefined; + // tslint:ensable:no-unsafe-any if (intent === 'None') { return Promise.resolve(false); } - logger.info(`NLP called: ${intent}, ${entity}`); + GBLog.info(`NLP called: ${intent} ${firstEntity}`); try { - await step.replaceDialog(`/${intent}`, nlp.entities); + await step.replaceDialog(` /${intent}`, nlp.entities); return Promise.resolve(true); } catch (error) { @@ -146,7 +154,7 @@ export class GBConversationalService implements IGBConversationalService { return Promise.resolve(false); } - public async checkLanguage(step, min, text) { + public async checkLanguage(step: GBDialogStep, min, text) { const locale = await AzureText.getLocale(min.instance.textAnalyticsKey, min.instance.textAnalyticsEndpoint, text); if (locale !== step.context.activity.locale.split('-')[0]) { switch (locale) { @@ -159,7 +167,7 @@ export class GBConversationalService implements IGBConversationalService { await step.context.sendActivity(Messages[locale].changing_language); break; default: - await step.context.sendActivity(`Unknown language: ${locale}`); + await step.context.sendActivity(`; Unknown; language: $;{locale;}`); break; } } diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index 72c0c1b2..07a7fd94 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -36,14 +36,13 @@ 'use strict'; -import { IGBCoreService, IGBInstallationDeployer, IGBInstance, IGBPackage } from 'botlib'; +import { GBLog, IGBCoreService, IGBInstallationDeployer, IGBInstance, IGBPackage } from 'botlib'; import * as fs from 'fs'; import { Sequelize } from 'sequelize-typescript'; import { GBAdminPackage } from '../../admin.gbapp/index'; import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; import { GBAnalyticsPackage } from '../../analytics.gblib'; import { StartDialog } from '../../azuredeployer.gbapp/dialogs/StartDialog'; -import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBCorePackage } from '../../core.gbapp'; import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp'; import { GBKBPackage } from '../../kb.gbapp'; @@ -52,14 +51,12 @@ import { GBWhatsappPackage } from '../../whatsapp.gblib/index'; import { GuaribasInstance } from '../models/GBModel'; import { GBConfigService } from './GBConfigService'; -const logger = require('../../../src/logger'); const opn = require('opn'); /** * Core service layer. */ export class GBCoreService implements IGBCoreService { - /** * Data access layer instance. */ @@ -121,10 +118,10 @@ export class GBCoreService implements IGBCoreService { throw new Error(`Unknown dialect: ${this.dialect}.`); } - const logging: any = + const logging: boolean | Function = GBConfigService.get('STORAGE_LOGGING') === 'true' ? (str: string): void => { - logger.info(str); + GBLog.info(str); } : false; @@ -153,12 +150,14 @@ export class GBCoreService implements IGBCoreService { if (this.dialect === 'mssql') { this.queryGenerator = this.sequelize.getQueryInterface().QueryGenerator; + // tslint:disable:no-unsafe-any this.createTableQuery = this.queryGenerator.createTableQuery; this.queryGenerator.createTableQuery = (tableName, attributes, options) => this.createTableQueryOverride(tableName, attributes, options); this.changeColumnQuery = this.queryGenerator.changeColumnQuery; this.queryGenerator.changeColumnQuery = (tableName, attributes) => this.changeColumnQueryOverride(tableName, attributes); + // tslint:enable:no-unsafe-any } } @@ -166,19 +165,21 @@ export class GBCoreService implements IGBCoreService { try { await this.sequelize.authenticate(); } catch (error) { - logger.info('Opening storage firewall on infrastructure...'); + GBLog.info('Opening storage firewall on infrastructure...'); + // tslint:disable:no-unsafe-any if (error.parent.code === 'ELOGIN') { await this.openStorageFrontier(installationDeployer); } else { throw error; } + // tslint:ensable:no-unsafe-any } } public async syncDatabaseStructure() { if (GBConfigService.get('STORAGE_SYNC') === 'true') { const alter = GBConfigService.get('STORAGE_SYNC_ALTER') === 'true'; - logger.info('Syncing database...'); + GBLog.info('Syncing database...'); return this.sequelize.sync({ alter: alter, @@ -186,7 +187,7 @@ export class GBCoreService implements IGBCoreService { }); } else { const msg = `Database synchronization is disabled.`; - logger.info(msg); + GBLog.info(msg); } } @@ -245,14 +246,14 @@ STORAGE_SYNC=true return await ngrok.connect({ port: port }); } else { - logger.warn('ngrok executable not found. Check installation or node_modules folder.'); + GBLog.warn('ngrok executable not found. Check installation or node_modules folder.'); return 'localhost'; } } catch (error) { // There are false positive from ngrok regarding to no memory, but it's just // lack of connection. - logger.verbose(error); + GBLog.verbose(error); throw new Error('Error connecting to remote ngrok server, please check network connection.'); } } @@ -274,14 +275,18 @@ STORAGE_SYNC=true * @param azureDeployer * @param proxyAddress */ - public async loadAllInstances(core: IGBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string) { - logger.info(`Loading instances from storage...`); + public async loadAllInstances( + core: IGBCoreService, + installationDeployer: IGBInstallationDeployer, + proxyAddress: string + ) { + GBLog.info(`Loading instances from storage...`); let instances: IGBInstance[]; try { instances = await core.loadInstances(); const instance = instances[0]; if (process.env.NODE_ENV === 'development') { - logger.info(`Updating bot endpoint to local reverse proxy (ngrok)...`); + GBLog.info(`Updating bot endpoint to local reverse proxy (ngrok)...`); await installationDeployer.updateBotProxy( instance.botId, instance.botId, @@ -290,15 +295,15 @@ STORAGE_SYNC=true } } catch (error) { // Check if storage is empty and needs formatting. - const isInvalidObject = error.parent.number == 208 || error.parent.errno == 1; // MSSQL or SQLITE. + const isInvalidObject = error.parent.number === 208 || error.parent.errno === 1; // MSSQL or SQLITE. if (isInvalidObject) { - if (GBConfigService.get('STORAGE_SYNC') != 'true') { + if (GBConfigService.get('STORAGE_SYNC') !== 'true') { throw new Error( `Operating storage is out of sync or there is a storage connection error. Try setting STORAGE_SYNC to true in .env file. Error: ${error.message}.` ); } else { - logger.info(`Storage is empty. After collecting storage structure from all .gbapps it will get synced.`); + GBLog.info(`Storage is empty. After collecting storage structure from all .gbapps it will get synced.`); } } else { throw new Error(`Cannot connect to operating storage: ${error.message}.`); @@ -316,7 +321,7 @@ STORAGE_SYNC=true * @param core */ public async ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService) { - if (!instances) { + if (instances === undefined) { const instance = new GuaribasInstance(); await instance.save(); instances = await core.loadInstances(); @@ -339,7 +344,7 @@ STORAGE_SYNC=true GBCustomerSatisfactionPackage, GBWhatsappPackage ].forEach(e => { - logger.info(`Loading sys package: ${e.name}...`); + GBLog.info(`Loading sys package: ${e.name}...`); const p = Object.create(e.prototype) as IGBPackage; p.loadPackage(core, core.sequelize); }); @@ -354,19 +359,27 @@ STORAGE_SYNC=true } } - public async createBootInstance(core: GBCoreService, installationDeployer: IGBInstallationDeployer, proxyAddress: string) { - - logger.info(`Deploying cognitive infrastructure (on the cloud / on premises)...`); + public async createBootInstance( + core: GBCoreService, + installationDeployer: IGBInstallationDeployer, + proxyAddress: string + ) { + GBLog.info(`Deploying cognitive infrastructure (on the cloud / on premises)...`); try { - let { instance, credentials, subscriptionId } = await StartDialog.createBaseInstance(installationDeployer); - instance = await installationDeployer.deployFarm(proxyAddress, instance, credentials, subscriptionId); - core.writeEnv(instance); - logger.info(`File .env written, starting General Bots...`); + const { instance, credentials, subscriptionId } = await StartDialog.createBaseInstance(installationDeployer); + const changedInstance = await installationDeployer.deployFarm( + proxyAddress, + instance, + credentials, + subscriptionId + ); + core.writeEnv(changedInstance); + GBLog.info(`File .env written, starting General Bots...`); GBConfigService.init(); - return instance; + return changedInstance; } catch (error) { - logger.warn( + GBLog.warn( `In case of error, please cleanup any infrastructure objects created during this procedure and .env before running again.` ); @@ -399,13 +412,13 @@ STORAGE_SYNC=true let sql: string = this.createTableQuery.apply(this.queryGenerator, [tableName, attributes, options]); const re1 = /CREATE\s+TABLE\s+\[([^\]]*)\]/; const matches = re1.exec(sql); - if (matches) { + if (matches !== null) { const table = matches[1]; const re2 = /PRIMARY\s+KEY\s+\(\[[^\]]*\](?:,\s*\[[^\]]*\])*\)/; sql = sql.replace( re2, (match: string, ...args: any[]): string => { - return 'CONSTRAINT [' + table + '_pk] ' + match; + return `CONSTRAINT [${table}_pk] ${match}`; } ); const re3 = /FOREIGN\s+KEY\s+\((\[[^\]]*\](?:,\s*\[[^\]]*\])*)\)/g; @@ -415,13 +428,13 @@ STORAGE_SYNC=true (match: string, ...args: any[]): string => { const fkcols = args[0]; let fkname = table; - let matches = re4.exec(fkcols); - while (matches != undefined) { - fkname += '_' + matches[1]; - matches = re4.exec(fkcols); + let matches2 = re4.exec(fkcols); + while (matches2 !== undefined) { + fkname += `_${matches2[1]}`; + matches2 = re4.exec(fkcols); } - return 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')'; + return `CONSTRAINT [${fkname}_fk] FOREIGN KEY (${fkcols})`; } ); } @@ -441,7 +454,7 @@ STORAGE_SYNC=true let sql: string = this.changeColumnQuery.apply(this.queryGenerator, [tableName, attributes]); const re1 = /ALTER\s+TABLE\s+\[([^\]]*)\]/; const matches = re1.exec(sql); - if (matches) { + if (matches !== null) { const table = matches[1]; const re2 = /(ADD\s+)?CONSTRAINT\s+\[([^\]]*)\]\s+FOREIGN\s+KEY\s+\((\[[^\]]*\](?:,\s*\[[^\]]*\])*)\)/g; const re3 = /\[([^\]]*)\]/g; @@ -450,13 +463,13 @@ STORAGE_SYNC=true (match: string, ...args: any[]): string => { const fkcols = args[2]; let fkname = table; - let matches = re3.exec(fkcols); - while (matches != undefined) { - fkname += '_' + matches[1]; - matches = re3.exec(fkcols); + let matches2 = re3.exec(fkcols); + while (matches2 !== undefined) { + fkname += `_${matches2[1]}`; + matches2 = re3.exec(fkcols); } - return (args[0] ? args[0] : '') + 'CONSTRAINT [' + fkname + '_fk] FOREIGN KEY (' + fkcols + ')'; + return `${args[0] ? args[0] : ''}CONSTRAINT [${fkname}_fk] FOREIGN KEY (${fkcols})`; } ); } @@ -471,7 +484,8 @@ STORAGE_SYNC=true */ private async openStorageFrontier(installationDeployer: IGBInstallationDeployer) { const group = GBConfigService.get('CLOUD_GROUP'); - const serverName = GBConfigService.get('STORAGE_SERVER').split('.database.windows.net')[0]; + const serverName = GBConfigService.get('STORAGE_SERVER') + .split('.database.windows.net')[0]; await installationDeployer.openStorageFirewall(group, serverName); } } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index b75c49ea..c5dd11f0 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -36,7 +36,7 @@ 'use strict'; -const logger = require('../../../src/logger'); + const Path = require('path'); const UrlJoin = require('url-join'); const Fs = require('fs'); @@ -109,7 +109,7 @@ export class GBDeployer { const dirs = getDirectories(path); dirs.forEach(element => { if (element.startsWith('.')) { - logger.info(`Ignoring ${element}...`); + GBLog.info(`Ignoring ${element}...`); } else { if (element.endsWith('.gbot')) { botPackages.push(element); @@ -122,9 +122,9 @@ export class GBDeployer { }); } - logger.info(`Starting looking for packages (.gbot, .gbtheme, .gbkb, .gbapp)...`); + GBLog.info(`Starting looking for packages (.gbot, .gbtheme, .gbkb, .gbapp)...`); paths.forEach(e => { - logger.info(`Looking in: ${e}...`); + GBLog.info(`Looking in: ${e}...`); doIt(e); }); @@ -136,11 +136,11 @@ export class GBDeployer { .interval(1000) .times(10) .condition(cb => { - logger.info(`Waiting for app package deployment...`); + GBLog.info(`Waiting for app package deployment...`); cb(appPackagesProcessed === gbappPackages.length); }) .done(async result => { - logger.info(`App Package deployment done.`); + GBLog.info(`App Package deployment done.`); ({ generalPackages, totalPackages } = await this.deployDataPackages( core, @@ -319,7 +319,7 @@ export class GBDeployer { public runOnce() { const root = 'packages/default.gbui'; if (!Fs.existsSync(`${root}/build`)) { - logger.info(`Preparing default.gbui (it may take some additional time for the first time)...`); + GBLog.info(`Preparing default.gbui (it may take some additional time for the first time)...`); Fs.writeFileSync(`${root}/.env`, 'SKIP_PREFLIGHT_CHECK=true'); child_process.execSync('npm install', { cwd: root }); child_process.execSync('npm run build', { cwd: root }); @@ -346,9 +346,9 @@ export class GBDeployer { botPackages.forEach(e => { if (e !== 'packages\\boot.gbot') { - logger.info(`Deploying bot: ${e}...`); + GBLog.info(`Deploying bot: ${e}...`); _this.deployBot(e); - logger.info(`Bot: ${e} deployed...`); + GBLog.info(`Bot: ${e} deployed...`); } }); @@ -357,7 +357,7 @@ export class GBDeployer { generalPackages = generalPackages.filter(p => !p.endsWith('.git')); generalPackages.forEach(filename => { const filenameOnly = Path.basename(filename); - logger.info(`Deploying package: ${filename}...`); + GBLog.info(`Deploying package: ${filename}...`); // Handles apps for general bots - .gbapp must stay out of deploy folder. @@ -365,10 +365,10 @@ export class GBDeployer { // Themes for bots. } else if (Path.extname(filename) === '.gbtheme') { server.use('/themes/' + filenameOnly, express.static(filename)); - logger.info(`Theme (.gbtheme) assets accessible at: ${'/themes/' + filenameOnly}.`); + GBLog.info(`Theme (.gbtheme) assets accessible at: ${'/themes/' + filenameOnly}.`); } else if (Path.extname(filename) === '.gbkb') { server.use('/kb/' + filenameOnly + '/subjects', express.static(UrlJoin(filename, 'subjects'))); - logger.info(`KB (.gbkb) assets accessible at: ${'/kb/' + filenameOnly}.`); + GBLog.info(`KB (.gbkb) assets accessible at: ${'/kb/' + filenameOnly}.`); } else if (Path.extname(filename) === '.gbui') { // Already Handled } else if (Path.extname(filename) === '.gbdialog') { @@ -385,14 +385,14 @@ export class GBDeployer { .interval(100) .times(5) .condition(cb => { - logger.info(`Waiting for package deployment...`); + GBLog.info(`Waiting for package deployment...`); cb(totalPackages === generalPackages.length); }) .done(result => { if (botPackages.length === 0) { - logger.info('Use ADDITIONAL_DEPLOY_PATH to point to a .gbai package folder (no external packages).'); + GBLog.info('Use ADDITIONAL_DEPLOY_PATH to point to a .gbai package folder (no external packages).'); } else { - logger.info(`Package deployment done.`); + GBLog.info(`Package deployment done.`); } resolve(); }); @@ -405,17 +405,17 @@ export class GBDeployer { gbappPackages.forEach(e => { // Skips .gbapp inside deploy folder. if (!e.startsWith('packages')) { - logger.info(`Deploying app: ${e}...`); + GBLog.info(`Deploying app: ${e}...`); let folder = Path.join(e, 'node_modules'); if (!Fs.existsSync(folder)) { - logger.info(`Installing modules for ${e}...`); + GBLog.info(`Installing modules for ${e}...`); child_process.execSync('npm install', { cwd: e }); } folder = Path.join(e, 'dist'); if (!Fs.existsSync()) { - logger.info(`Compiling ${e}...`); + GBLog.info(`Compiling ${e}...`); try { child_process.execSync(Path.join(e, 'node_modules/.bin/tsc'), { cwd: e }); @@ -424,15 +424,15 @@ export class GBDeployer { const p = new m.Package(); p.loadPackage(core, core.sequelize); appPackages.push(p); - logger.info(`App (.gbapp) deployed: ${e}.`); + GBLog.info(`App (.gbapp) deployed: ${e}.`); appPackagesProcessed++; }) .catch(err => { - logger.error(`Error deploying .gbapp package: ${e}\n${err}`); + GBLog.error(`Error deploying .gbapp package: ${e}\n${err}`); appPackagesProcessed++; }); } catch (error) { - logger.error(`Error compiling .gbapp package ${e}:\n${error.stdout.toString()}`); + GBLog.error(`Error compiling .gbapp package ${e}:\n${error.stdout.toString()}`); appPackagesProcessed++; } } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 6722f8c8..862c54f5 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -39,14 +39,14 @@ const { DialogSet, TextPrompt } = require('botbuilder-dialogs'); const UrlJoin = require('url-join'); const express = require('express'); -const logger = require('../../../src/logger'); + const request = require('request-promise-native'); const AuthenticationContext = require('adal-node').AuthenticationContext; import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder'; import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; import { GBAnalyticsPackage } from '../../analytics.gblib'; import { GBCorePackage } from '../../core.gbapp'; import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp'; @@ -141,14 +141,14 @@ export class GBMinService { server.post(url, async (req, res) => { await this.receiver(adapter, req, res, conversationState, min, instance, appPackages); }); - logger.info(`GeneralBots(${instance.engineName}) listening on: ${url}.`); + GBLog.info(`GeneralBots(${instance.engineName}) listening on: ${url}.`); // Serves individual URL for each bot user interface. const uiUrl = `/${instance.botId}`; server.use(uiUrl, express.static(UrlJoin(GBDeployer.deployFolder, uiPackage, 'build'))); - logger.info(`Bot UI ${uiPackage} accessible at: ${uiUrl}.`); + GBLog.info(`Bot UI ${uiPackage} accessible at: ${uiUrl}.`); const state = `${instance.instanceId}${Math.floor(Math.random() * 1000000000)}`; // Clients get redirected here in order to create an OAuth authorize url and redirect them to AAD. @@ -171,7 +171,7 @@ export class GBMinService { const state = await min.adminService.getValue(instance.instanceId, 'AntiCSRFAttackState'); if (req.query.state !== state) { const msg = 'WARNING: state field was not provided as anti-CSRF token'; - logger.error(msg); + GBLog.error(msg); throw new Error(msg); } const authenticationContext = new AuthenticationContext( @@ -187,7 +187,7 @@ export class GBMinService { async (err, token) => { if (err) { const msg = `Error acquiring token: ${err}`; - logger.error(msg); + GBLog.error(msg); res.send(msg); } else { await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); @@ -245,7 +245,7 @@ export class GBMinService { } else { const error = `Instance not found: ${botId}.`; res.sendStatus(error); - logger.error(error); + GBLog.error(error); } } @@ -354,7 +354,7 @@ export class GBMinService { if (sysPackage.name === 'GBWhatsappPackage') { const url = '/instances/:botId/whatsapp'; server.post(url, (req, res) => { - p.channel.received(req, res); + p['channel'].received(req, res); }); } }, this); @@ -405,7 +405,7 @@ export class GBMinService { await min.userProfile.set(step.context, user); } - logger.info( + GBLog.info( `User>: ${context.activity.text} (${context.activity.type}, ${context.activity.name}, ${ context.activity.channelId }, {context.activity.value})` @@ -413,7 +413,7 @@ export class GBMinService { if (context.activity.type === 'conversationUpdate' && context.activity.membersAdded.length > 0) { const member = context.activity.membersAdded[0]; if (member.name === 'GeneralBots') { - logger.info(`Bot added to conversation, starting chat...`); + GBLog.info(`Bot added to conversation, starting chat...`); appPackages.forEach(e => { e.onNewSession(min, step); }); @@ -421,7 +421,7 @@ export class GBMinService { await step.beginDialog('/'); } else { - logger.info(`Member added to conversation: ${member.name}`); + GBLog.info(`Member added to conversation: ${member.name}`); } // Processes messages. @@ -440,7 +440,7 @@ export class GBMinService { await conversationState.saveChanges(context, true); } catch (error) { const msg = `ERROR: ${error.message} ${error.stack ? error.stack : ''}`; - logger.error(msg); + GBLog.error(msg); await step.context.sendActivity(Messages[step.context.activity.locale].very_sorry_about_error); await step.beginDialog('/ask', { isReturning: true }); @@ -448,7 +448,7 @@ export class GBMinService { }); } - private async processEventActivity(context, step: any) { + private async processEventActivity(context, step: GBDialogStep) { if (context.activity.name === 'whoAmI') { await step.beginDialog('/whoAmI'); } else if (context.activity.name === 'showSubjects') { @@ -476,7 +476,7 @@ export class GBMinService { } } - private async processMessageActivity(context, min: GBMinInstance, step: any) { + private async processMessageActivity(context, min: GBMinInstance, step: GBDialogStep) { // Direct script invoking by itent name. const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined; diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index 8690a607..35e477c8 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -33,20 +33,19 @@ 'use strict'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance, GBService, IGBCoreService } from 'botlib'; +import { GBLog, GBMinInstance, GBService, IGBCoreService } from 'botlib'; import * as fs from 'fs'; -import GBAPIService from './GBAPIService'; -import GBAPIService from './GBAPIService'; import { GBDeployer } from './GBDeployer'; import { TSCompiler } from './TSCompiler'; const walkPromise = require('walk-promise'); -const logger = require('../../../src/logger'); + const vm = require('vm'); const UrlJoin = require('url-join'); const vb2ts = require('vbscript-to-typescript/dist/converter'); const beautify = require('js-beautify').js; + /** * @fileoverview Virtualization services for emulation of BASIC. * This alpha version is using a hack in form of converter to @@ -220,7 +219,7 @@ export class GBVMService extends GBService { vm.runInContext(parsedCode, context); min.sandBoxMap[mainName] = sandbox; await deployer.deployScriptToStorage(1, filename); // TODO: Per bot storage. - logger.info(`[GBVMService] Finished loading of ${filename}`); + GBLog.info(`[GBVMService] Finished loading of ${filename}`); } } @@ -260,7 +259,7 @@ export class GBVMService extends GBService { const cbId = step.activeDialog.state.cbId; const cb = min.cbMap[cbId]; - cb.bind({ step: step, context: step.context }); // TODO: Necessary or min.sandbox? + cb.bind({ step: step: GBDialogStep, context: step.context }); // TODO: Necessary or min.sandbox? await step.endDialog(); diff --git a/packages/core.gbapp/services/TSCompiler.ts b/packages/core.gbapp/services/TSCompiler.ts index 942e82b0..c1cc88da 100644 --- a/packages/core.gbapp/services/TSCompiler.ts +++ b/packages/core.gbapp/services/TSCompiler.ts @@ -37,7 +37,7 @@ 'use strict'; import * as ts from 'typescript'; -const logger = require('../../../src/logger'); + export class TSCompiler { @@ -77,9 +77,9 @@ export class TSCompiler { if (diagnostic.file) { const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); - logger.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); + GBLog.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { - logger.error(`${message}`); + GBLog.error(`${message}`); } } }); diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index e66d26e7..96cdd6e7 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -86,7 +86,7 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].about_suggestions); - step.activeDialog.state.cbId = step.options.id; + step.activeDialog.state.cbId = step.options['id']; return await step.prompt('textPrompt', Messages[locale].what_about_service); }, diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index 186259fe..21b8bc01 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -43,7 +43,7 @@ import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance } from 'botlib'; import { CSService } from '../services/CSService'; import { Messages } from '../strings'; -const logger = require('../../../src/logger'); + export class QualityDialog extends IGBDialog { /** @@ -63,7 +63,7 @@ export class QualityDialog extends IGBDialog { const score = step.result; setTimeout( - () => min.conversationalService.sendEvent(step, 'stop', null), + () => min.conversationalService.sendEvent(step: GBDialogStep, 'stop', null), 400 ); diff --git a/packages/customer-satisfaction.gbapp/index.ts b/packages/customer-satisfaction.gbapp/index.ts index 33782cf6..42898ba7 100644 --- a/packages/customer-satisfaction.gbapp/index.ts +++ b/packages/customer-satisfaction.gbapp/index.ts @@ -57,5 +57,5 @@ export class GBCustomerSatisfactionPackage implements IGBPackage { QualityDialog.setup(min.bot, min); } public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index f517a96c..fc95465d 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -44,7 +44,7 @@ import { AzureText } from 'pragmatismo-io-framework'; import { Messages } from '../strings'; import { KBService } from './../services/KBService'; -const logger = require('../../../src/logger'); + export class AskDialog extends IGBDialog { /** @@ -65,7 +65,7 @@ export class AskDialog extends IGBDialog { // Sends the answer to all outputs, including projector. - await service.sendAnswer(min.conversationalService, step, answer); + await service.sendAnswer(min.conversationalService, step: GBDialogStep, answer); await step.replaceDialog('/ask', { isReturning: true }); } @@ -88,7 +88,7 @@ export class AskDialog extends IGBDialog { // Stops any content on projector. - await min.conversationalService.sendEvent(step, 'stop', null); + await min.conversationalService.sendEvent(step: GBDialogStep, 'stop', null); // Handle extra text from FAQ. @@ -104,7 +104,7 @@ export class AskDialog extends IGBDialog { const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text); if (data != text) { - logger.info(`Spelling corrected: ${data}`); + GBLog.info(`Spelling corrected: ${data}`); text = data; } } @@ -126,7 +126,7 @@ export class AskDialog extends IGBDialog { // Sends the answer to all outputs, including projector. - await service.sendAnswer(min.conversationalService, step, resultsA.answer); + await service.sendAnswer(min.conversationalService, step: GBDialogStep, resultsA.answer); // Goes to ask loop, again. @@ -155,11 +155,11 @@ export class AskDialog extends IGBDialog { // Sends the answer to all outputs, including projector. - await service.sendAnswer(min.conversationalService, step, resultsB.answer); + await service.sendAnswer(min.conversationalService, step: GBDialogStep, resultsB.answer); return await step.replaceDialog('/ask', { isReturning: true }); } else { - if (!(await min.conversationalService.routeNLP(step, min, text))) { + if (!(await min.conversationalService.routeNLP(step: GBDialogStep, min, text))) { await step.context.sendActivity(Messages[locale].did_not_find); return await step.replaceDialog('/ask', { isReturning: true }); diff --git a/packages/kb.gbapp/dialogs/FaqDialog.ts b/packages/kb.gbapp/dialogs/FaqDialog.ts index 142a0c14..f837e4cd 100644 --- a/packages/kb.gbapp/dialogs/FaqDialog.ts +++ b/packages/kb.gbapp/dialogs/FaqDialog.ts @@ -59,12 +59,13 @@ export class FaqDialog extends IGBDialog { const data = await service.getFaqBySubjectArray('faq', null); const locale = step.context.activity.locale; if (data) { - await min.conversationalService.sendEvent(step, 'play', { + await min.conversationalService.sendEvent(step: GBDialogStep, 'play', { playerType: 'bullet', data: data.slice(0, 10) }); - await step.context.sendActivity(Messages[locale].see_faq); + await step.context.sendActivity(Messages[locale].see_faq); + return await step.next(); } } diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts index 0d34eaa5..6505ccfe 100644 --- a/packages/kb.gbapp/dialogs/MenuDialog.ts +++ b/packages/kb.gbapp/dialogs/MenuDialog.ts @@ -89,7 +89,7 @@ export class MenuDialog extends IGBDialog { 'menu', user.subjects ); - await min.conversationalService.sendEvent(step, 'play', { + await min.conversationalService.sendEvent(step: GBDialogStep, 'play', { playerType: 'bullet', data: data.slice(0, 10) }); diff --git a/packages/kb.gbapp/index.ts b/packages/kb.gbapp/index.ts index 9eba17b8..4f5af31a 100644 --- a/packages/kb.gbapp/index.ts +++ b/packages/kb.gbapp/index.ts @@ -61,5 +61,5 @@ export class GBKBPackage implements IGBPackage { MenuDialog.setup(min.bot, min); } public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index c81113d6..c6ceda5d 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -34,7 +34,7 @@ * @fileoverview Knowledge base services and logic. */ -const logger = require('../../../src/logger'); + const Path = require('path'); const Fs = require('fs'); @@ -276,7 +276,7 @@ export class KBService { answer = Fs.readFileSync(mediaFilename, 'utf8'); format = '.md'; } else { - logger.info(`[GBImporter] File not found: ${mediaFilename}.`); + GBLog.info(`[GBImporter] File not found: ${mediaFilename}.`); answer = ''; } } @@ -341,9 +341,9 @@ export class KBService { }); } - public async sendAnswer(conversationalService: IGBConversationalService, step: any, answer: GuaribasAnswer) { + public async sendAnswer(conversationalService: IGBConversationalService, step: GBDialogStep, answer: GuaribasAnswer) { if (answer.content.endsWith('.mp4')) { - await conversationalService.sendEvent(step, 'play', { + await conversationalService.sendEvent(step: GBDialogStep, 'play', { playerType: 'video', data: answer.content }); @@ -367,7 +367,7 @@ export class KBService { }); html = marked(answer.content); } - await conversationalService.sendEvent(step, 'play', { + await conversationalService.sendEvent(step: GBDialogStep, 'play', { playerType: 'markdown', data: { content: html, @@ -378,7 +378,7 @@ export class KBService { }); } else { await step.context.sendActivity(answer.content); - await conversationalService.sendEvent(step, 'stop', null); + await conversationalService.sendEvent(step: GBDialogStep, 'stop', null); } } @@ -462,15 +462,15 @@ export class KBService { public async deployKb(core: IGBCoreService, deployer: GBDeployer, localPath: string) { const packageType = Path.extname(localPath); const packageName = Path.basename(localPath); - logger.info(`[GBDeployer] Opening package: ${localPath}`); + GBLog.info(`[GBDeployer] Opening package: ${localPath}`); const packageObject = JSON.parse(Fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8')); const instance = await core.loadInstance(packageObject.botId); - logger.info(`[GBDeployer] Importing: ${localPath}`); + GBLog.info(`[GBDeployer] Importing: ${localPath}`); const p = await deployer.deployPackageToStorage(instance.instanceId, packageName); await this.importKbPackage(localPath, p, instance); deployer.rebuildIndex(instance, new AzureDeployerService(deployer).getKBSearchSchema(instance.searchIndex)); - logger.info(`[GBDeployer] Finished import of ${localPath}`); + GBLog.info(`[GBDeployer] Finished import of ${localPath}`); } } diff --git a/packages/security.gblib/index.ts b/packages/security.gblib/index.ts index 0ae9674a..12133320 100644 --- a/packages/security.gblib/index.ts +++ b/packages/security.gblib/index.ts @@ -56,5 +56,5 @@ export class GBSecurityPackage implements IGBPackage { public loadBot(min: GBMinInstance): void {} public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts index 4f06006e..6a0ca8a9 100644 --- a/packages/whatsapp.gblib/index.ts +++ b/packages/whatsapp.gblib/index.ts @@ -69,5 +69,5 @@ export class GBWhatsappPackage implements IGBPackage { } public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: any): void {} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 4c5506a6..befb941c 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -1,5 +1,5 @@ const UrlJoin = require('url-join'); -const logger = require('../../../src/logger'); + const Swagger = require('swagger-client'); const rp = require('request-promise'); import { GBService } from 'botlib'; @@ -65,15 +65,15 @@ export class WhatsappDirectLine extends GBService { try { const result = await request.post(options); - logger.info(result); + GBLog.info(result); } catch (error) { - logger.error('Error initializing 3rd party Whatsapp provider.', error); + GBLog.error('Error initializing 3rd party Whatsapp provider.', error); } return client; }) .catch(err => { - logger.error('Error initializing DirectLine client', err); + GBLog.error('Error initializing DirectLine client', err); }); } @@ -86,13 +86,13 @@ export class WhatsappDirectLine extends GBService { return; // Exit here. } - logger.info(`GBWhatsapp: Hook called. from: ${from}(${fromName}), text: ${text})`); + GBLog.info(`GBWhatsapp: Hook called. from: ${from}(${fromName}), text: ${text})`); const conversationId = this.conversationIds[from]; this.directLineClient.then(client => { if (this.conversationIds[from] == undefined) { - logger.info(`GBWhatsapp: Starting new conversation on Bot.`); + GBLog.info(`GBWhatsapp: Starting new conversation on Bot.`); client.Conversations.Conversations_StartConversation() .then(response => { return response.obj.conversationId; @@ -127,12 +127,12 @@ export class WhatsappDirectLine extends GBService { replyToId: from } }).catch(err => { - logger.error(`GBWhatsapp: Error receiving message: ${err}.`); + GBLog.error(`GBWhatsapp: Error receiving message: ${err}.`); }); } public pollMessages(client, conversationId, from, fromName) { - logger.info(`GBWhatsapp: Starting polling message for conversationId: + GBLog.info(`GBWhatsapp: Starting polling message for conversationId: ${conversationId}.`); setInterval(() => { @@ -171,7 +171,7 @@ export class WhatsappDirectLine extends GBService { let output = ''; if (activity.text) { - logger.info(`GBWhatsapp: MSG: ${activity.text}`); + GBLog.info(`GBWhatsapp: MSG: ${activity.text}`); output = activity.text; } @@ -183,7 +183,7 @@ export class WhatsappDirectLine extends GBService { break; case 'image/png': - logger.info('Opening the requested image ' + attachment.contentUrl); + GBLog.info('Opening the requested image ' + attachment.contentUrl); output += `\n${attachment.contentUrl}`; break; } diff --git a/src/app.ts b/src/app.ts index 7a1750fd..3f913f5e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -62,7 +62,7 @@ export class GBServer { */ public static run() { - logger.info(`The Bot Server is in STARTING mode...`); + GBLog.info(`The Bot Server is in STARTING mode...`); // Creates a basic HTTP server that will serve several URL, one for each // bot instance. This allows the same server to attend multiple Bot on @@ -83,7 +83,7 @@ export class GBServer { server.listen(port, () => { (async () => { try { - logger.info(`Now accepting connections on ${port}...`); + GBLog.info(`Now accepting connections on ${port}...`); // Reads basic configuration, initialize minimal services. @@ -98,7 +98,7 @@ export class GBServer { // Ensure that local development proxy is setup. - logger.info(`Establishing a development local proxy (ngrok)...`); + GBLog.info(`Establishing a development local proxy (ngrok)...`); const proxyAddress: string = await core.ensureProxy(port); // Creates a boot instance or load it from storage. @@ -115,14 +115,14 @@ export class GBServer { // Deploys system and user packages. - logger.info(`Deploying packages...`); + GBLog.info(`Deploying packages...`); core.loadSysPackages(core); await core.checkStorage(azureDeployer); await deployer.deployPackages(core, server, appPackages); // Loads all bot instances. - logger.info(`Publishing instances...`); + GBLog.info(`Publishing instances...`); const packageInstance = await importer.importIfNotExistsBotPackage( GBConfigService.get('CLOUD_GROUP'), 'boot.gbot', @@ -145,13 +145,13 @@ export class GBServer { deployer.runOnce(); - logger.info(`The Bot Server is in RUNNING mode...`); + GBLog.info(`The Bot Server is in RUNNING mode...`); // Opens Navigator. core.openBrowserInDevelopment(); } catch (err) { - logger.error(`STOP: ${err} ${err.stack ? err.stack : ''}`); + GBLog.error(`STOP: ${err} ${err.stack ? err.stack : ''}`); process.exit(1); } })(); diff --git a/src/logger.ts b/src/logger.ts deleted file mode 100644 index ee201a78..00000000 --- a/src/logger.ts +++ /dev/null @@ -1,76 +0,0 @@ -/*****************************************************************************\ -| ( )_ _ | -| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | -| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | -| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | -| | | ( )_) | | -| (_) \___/' | -| | -| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | -| Licensed under the AGPL-3.0. | -| | -| According to our dual licensing model, this program can be used either | -| under the terms of the GNU Affero General Public License, version 3, | -| or under a proprietary license. | -| | -| The texts of the GNU Affero General Public License with an additional | -| permission and of our proprietary license can be found at and | -| in the LICENSE file you have received along with this program. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY, without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Affero General Public License for more details. | -| | -| "General Bots" is a registered trademark of Pragmatismo.io. | -| The licensing of the program under the AGPLv3 does not imply a | -| trademark license. Therefore any rights, title and interest in | -| our trademarks remain entirely with us. | -| | -\*****************************************************************************/ - -/** - * @fileoverview Logging support. - */ - -const { createLogger, format, transports } = require('winston'); - -const config = { - levels: { - error: 0, - debug: 1, - warn: 2, - data: 3, - info: 4, - verbose: 5, - silly: 6, - custom: 7 - }, - colors: { - error: 'red', - debug: 'blue', - warn: 'yellow', - data: 'grey', - info: 'green', - verbose: 'cyan', - silly: 'magenta', - custom: 'yellow' - } -}; - -const logger = createLogger({ - format: format.combine( - format.colorize(), - format.simple(), - format.label({ label: 'GeneralBots' }), - format.timestamp(), - format.printf(nfo => { - return `${nfo.timestamp} [${nfo.label}] ${nfo.level}: ${nfo.message}`; - }) - ), - levels: config.levels, - transports: [new transports.Console()] -}); - -module.exports = logger; diff --git a/tslint.json b/tslint.json index 3ed5212b..7480486c 100644 --- a/tslint.json +++ b/tslint.json @@ -1,43 +1,40 @@ { - "defaultSeverity": "warning", - "extends": [ - "tslint:recommended", - "tslint-microsoft-contrib" - ], - "linterOptions": { - "exclude":[ - "libraries/botframework-connector/src/generated/**/*", - "libraries/botframework-schema/**/*" - ] - }, - "rulesDirectory": [ - "node_modules/tslint-microsoft-contrib" - ], - "jsRules": {}, - "rules": { - "no-floating-promises": false, - "no-var-requires":false, - "typedef":false, - "variable-name": false, - "no-parameter-properties": false, - "no-reserved-keywords": false, - "no-unnecessary-class":false, - "no-require-imports": false, - "function-name": false, - "no-redundant-jsdoc": false, - "no-return-await": false, - "prefer-type-cast": false, - "no-object-literal-type-assertion":false, - "no-increment-decrement":false, - "no-any":false, - "interface-name":false, - "no-this-assignment":false, - "switch-final-break":false, - "no-parameter-reassignment":false, - "export-name":false, - "no-relative-imports": false, - "no-backbone-get-set-outside-model": false, - "max-line-length": [true,{"limit":120,"ignore-pattern":"^\\s+\\*"}], - "await-promise": [true, "Bluebird"] - } + "defaultSeverity": "warning", + "extends": ["tslint:recommended", "tslint-microsoft-contrib"], + "linterOptions": { + "exclude": [ + "libraries/botframework-connector/src/generated/**/*", + "libraries/botframework-schema/**/*", + "./packages/default.gbui/**/*", + "./packages/**/*.gbdialog" + ] + }, + "rulesDirectory": ["node_modules/tslint-microsoft-contrib"], + "jsRules": {}, + "rules": { + "no-floating-promises": false, + "no-var-requires": false, + "typedef": false, + "variable-name": false, + "no-parameter-properties": false, + "no-reserved-keywords": false, + "no-unnecessary-class": false, + "no-require-imports": false, + "function-name": false, + "no-redundant-jsdoc": false, + "no-return-await": false, + "prefer-type-cast": false, + "no-object-literal-type-assertion": false, + "no-increment-decrement": false, + "no-any": false, + "interface-name": false, + "no-this-assignment": false, + "switch-final-break": false, + "no-parameter-reassignment": false, + "export-name": false, + "no-relative-imports": false, + "no-backbone-get-set-outside-model": false, + "max-line-length": [true, { "limit": 120, "ignore-pattern": "^\\s+\\*" }], + "await-promise": [true, "Bluebird"] + } } From d717de6245a0263aea7ad8205bf896d82746b434 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 8 Mar 2019 19:13:00 -0300 Subject: [PATCH 21/32] fix(general): tslint being applied in all sources. --- .prettierrc | 1 + package-lock.json | 347 +++++------------- package.json | 27 +- packages/admin.gbapp/dialogs/AdminDialog.ts | 49 +-- .../admin.gbapp/services/GBAdminService.ts | 13 +- packages/analytics.gblib/index.ts | 32 +- .../dialogs/BotFarmDialog.ts | 69 ---- .../dialogs/StartDialog.ts | 25 +- packages/azuredeployer.gbapp/index.ts | 30 +- .../services/AzureDeployerService.ts | 58 ++- packages/console.gblib/index.ts | 29 +- .../services/ConsoleDirectLine.ts | 102 +++-- packages/core.gbapp/index.ts | 22 +- packages/core.gbapp/services/GBAPIService.ts | 22 +- .../core.gbapp/services/GBConfigService.ts | 4 +- .../services/GBConversationalService.ts | 2 +- packages/core.gbapp/services/GBDeployer.ts | 5 +- .../core.gbapp/services/GBImporterService.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 2 +- packages/core.gbapp/services/GBVMService.ts | 8 +- packages/core.gbapp/services/TSCompiler.ts | 1 - .../dialogs/FeedbackDialog.ts | 2 +- .../dialogs/QualityDialog.ts | 1 - packages/customer-satisfaction.gbapp/index.ts | 20 +- packages/kb.gbapp/dialogs/AskDialog.ts | 30 +- packages/kb.gbapp/dialogs/MenuDialog.ts | 8 +- packages/kb.gbapp/index.ts | 20 +- packages/kb.gbapp/services/KBService.ts | 114 +++--- packages/security.gblib/index.ts | 27 +- .../security.gblib/services/SecService.ts | 2 +- packages/whatsapp.gblib/index.ts | 16 +- .../services/WhatsappDirectLine.ts | 10 +- tslint.json | 3 + 33 files changed, 458 insertions(+), 645 deletions(-) delete mode 100644 packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts diff --git a/.prettierrc b/.prettierrc index c1e1114c..af8db0fa 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,4 +5,5 @@ "arrowParens": "avoid", "semi": true, "singleQuote": true + } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ea1d9d4e..7d26985e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -986,15 +986,6 @@ "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": "1.4.0", - "resolved": "https://registry.npmjs.org/@microsoft/microsoft-graph-client/-/microsoft-graph-client-1.4.0.tgz", - "integrity": "sha512-dX7053APLpIaGMGqJrDjBVX7ZO+vntKTvyB1WIy4WpC8qE3qdE68MDOq5Vv6JPG879KygPiCH2ex5RCAK+OR0Q==", - "requires": { - "es6-promise": "^4.1.0", - "isomorphic-fetch": "^2.2.1" - } - }, "@microsoft/recognizers-text": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text/-/recognizers-text-1.1.4.tgz", @@ -1606,7 +1597,7 @@ "@types/is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@types/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-uE17sgeiEPKvm+1DHcD76cQUO+E=", + "integrity": "sha512-jkZatu4QVbR60mpIzjINmtS1ZF4a/FqdTUTBeQDVOQ2PYyidtwFKr0B5G6ERukKwliq+7mIXvxyppwzG5EgRYg==", "requires": { "@types/node": "*" } @@ -1647,7 +1638,7 @@ "@types/node-fetch": { "version": "1.6.9", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-1.6.9.tgz", - "integrity": "sha1-p1D7D0zylgv3K0YuTIaQgCLdacU=", + "integrity": "sha512-n2r6WLoY7+uuPT7pnEtKJCmPUGyJ+cbyBR8Avnu4+m1nzz7DwBVuyIvvlBzCZ/nrpC7rIgb3D6pNavL7rFEa9g==", "requires": { "@types/node": "*" } @@ -1671,23 +1662,6 @@ "@types/request": "*" } }, - "@types/semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==" - }, - "@types/sequelize": { - "version": "4.27.38", - "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.38.tgz", - "integrity": "sha512-HR+epHzmU8xSMRUjhuuYKHn3IxD2Ft4OePEqXY8/6otDyPn9s6SZx4bVLnUa98jv6Ny0Di9IHQHOXh35O7QajQ==", - "dev": true, - "requires": { - "@types/bluebird": "*", - "@types/continuation-local-storage": "*", - "@types/lodash": "*", - "@types/validator": "*" - } - }, "@types/shelljs": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.2.tgz", @@ -1711,7 +1685,7 @@ "@types/uuid": { "version": "3.4.4", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.4.tgz", - "integrity": "sha1-evaTYPpl7w3stB/RUL9MpcDO/fU=", + "integrity": "sha512-tPIgT0GUmdJQNSHxp0X2jnpQfBSTfGxUMc/2CXBU2mnyTFVYVa2ojpoQ74w0U2yn2vw3jnC640+77lkFFpdVDw==", "requires": { "@types/node": "*" } @@ -2030,11 +2004,6 @@ "readable-stream": "^2.0.6" } }, - "arg": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.0.tgz", - "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==" - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2789,6 +2758,28 @@ "ms-rest-js": "^0.2.5", "request": "2.83.0", "rsa-pem-from-mod-exp": "^0.8.4" + }, + "dependencies": { + "ms-rest-js": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-0.2.8.tgz", + "integrity": "sha512-KgiSsbJzKcPLx0Zaca5PEdGOwm8X4Np+aTukK6stMl2eAqSrHvncjteyeXi6v6O0ECLYeUWVbqcPJfpw1PjnZQ==", + "requires": { + "@types/form-data": "^2.2.1", + "@types/is-stream": "^1.1.0", + "@types/node": "^9.4.6", + "@types/node-fetch": "^1.6.7", + "@types/uuid": "^3.4.3", + "fetch-cookie": "^0.7.0", + "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#master", + "form-data": "^2.3.2", + "is-buffer": "^2.0.0", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "url-parse": "^1.2.0", + "uuid": "^3.2.1" + } + } } }, "botframework-schema": { @@ -2808,6 +2799,11 @@ "har-schema": "^2.0.0" } }, + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + }, "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", @@ -3007,6 +3003,28 @@ "ms-rest-js": "^0.2.5", "request": "2.83.0", "rsa-pem-from-mod-exp": "^0.8.4" + }, + "dependencies": { + "ms-rest-js": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-0.2.8.tgz", + "integrity": "sha512-KgiSsbJzKcPLx0Zaca5PEdGOwm8X4Np+aTukK6stMl2eAqSrHvncjteyeXi6v6O0ECLYeUWVbqcPJfpw1PjnZQ==", + "requires": { + "@types/form-data": "^2.2.1", + "@types/is-stream": "^1.1.0", + "@types/node": "^9.4.6", + "@types/node-fetch": "^1.6.7", + "@types/uuid": "^3.4.3", + "fetch-cookie": "^0.7.0", + "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#master", + "form-data": "^2.3.2", + "is-buffer": "^2.0.0", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "url-parse": "^1.2.0", + "uuid": "^3.2.1" + } + } } }, "botframework-schema": { @@ -3026,6 +3044,11 @@ "har-schema": "^2.0.0" } }, + "is-buffer": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", + "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + }, "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", @@ -3779,11 +3802,6 @@ "restore-cursor": "^2.0.0" } }, - "cli-spinner": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/cli-spinner/-/cli-spinner-0.2.8.tgz", - "integrity": "sha1-gWnZ/66HBnZEXm7kOX6Vp6Fb2AU=" - }, "cli-table": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", @@ -4058,12 +4076,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", - "dev": true - }, "commitizen": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-3.0.7.tgz", @@ -4250,15 +4262,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, - "config-chain": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", - "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", - "requires": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - } - }, "configstore": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", @@ -5308,31 +5311,6 @@ "safe-buffer": "^5.0.1" } }, - "editorconfig": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.2.tgz", - "integrity": "sha512-GWjSI19PVJAM9IZRGOS+YKI8LN+/sjkSjNyvxL5ucqP9/IqtYNXBaQ/6c/hkPNYQHyOHra2KoXZI/JVpuqwmcQ==", - "requires": { - "@types/node": "^10.11.7", - "@types/semver": "^5.5.0", - "commander": "^2.19.0", - "lru-cache": "^4.1.3", - "semver": "^5.6.0", - "sigmund": "^1.0.1" - }, - "dependencies": { - "commander": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" - }, - "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" - } - } - }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -5495,7 +5473,8 @@ "es6-promise": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", - "integrity": "sha1-2m0NVpLvtGHggsFIF/4kJ9j10FQ=" + "integrity": "sha1-2m0NVpLvtGHggsFIF/4kJ9j10FQ=", + "dev": true }, "es6-promisify": { "version": "5.0.0", @@ -6014,12 +5993,31 @@ "fetch-cookie": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.7.2.tgz", - "integrity": "sha1-W+US9xIbC80uNENQrXF3J6w7Gl0=", + "integrity": "sha512-Udm6ls1tV/pR9+EOjTYW2aGBadN03zOgVwu6grybxOg9ufACq7wE1HY/jh06DOykXH9FLYJC2RbUD3kJZcJBRg==", "requires": { "es6-denodeify": "^0.1.1", "tough-cookie": "^2.3.1" } }, + "fetch-ponyfill": { + "version": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db", + "from": "github:amarzavery/fetch-ponyfill#master", + "requires": { + "fetch-cookie": "~0.6.0", + "node-fetch": "~1.7.1" + }, + "dependencies": { + "fetch-cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.6.0.tgz", + "integrity": "sha1-T+xOQIzAAH9sBOVTYYr0s97jf2k=", + "requires": { + "es6-denodeify": "^0.1.1", + "tough-cookie": "^2.3.1" + } + } + } + }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -8207,15 +8205,6 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, - "isomorphic-fetch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", - "requires": { - "node-fetch": "^1.0.1", - "whatwg-fetch": ">=0.10.0" - } - }, "isomorphic-form-data": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-0.0.1.tgz", @@ -8285,33 +8274,6 @@ "integrity": "sha512-CpKJh9VRNhS+XqZtg1UMejETGEiqwCGDC/uwPEEQwc2nfdbSm73SIE29TplG2gLYuBOOTNDqxzG6A9NtEPLt0w==", "dev": true }, - "js-beautify": { - "version": "1.8.9", - "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.8.9.tgz", - "integrity": "sha512-MwPmLywK9RSX0SPsUJjN7i+RQY9w/yC17Lbrq9ViEefpLRgqAR2BgrMN2AbifkUuhDV8tRauLhLda/9+bE0YQA==", - "requires": { - "config-chain": "^1.1.12", - "editorconfig": "^0.15.2", - "glob": "^7.1.3", - "mkdirp": "~0.5.0", - "nopt": "~4.0.1" - }, - "dependencies": { - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -8936,11 +8898,6 @@ "pify": "^3.0.0" } }, - "make-error": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==" - }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -9542,54 +9499,16 @@ } }, "ms-rest-js": { - "version": "0.2.8", - "resolved": "http://registry.npmjs.org/ms-rest-js/-/ms-rest-js-0.2.8.tgz", - "integrity": "sha512-KgiSsbJzKcPLx0Zaca5PEdGOwm8X4Np+aTukK6stMl2eAqSrHvncjteyeXi6v6O0ECLYeUWVbqcPJfpw1PjnZQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.1.tgz", + "integrity": "sha512-o2Gms3XE4sCKm0FZLJicq0aa2ybYyV8pwUHKHJG1QExkk/csM7PLuHiaPAj6Xn3kzqzAx4cAYtyEp4P1T3ujyA==", "requires": { - "@types/form-data": "^2.2.1", - "@types/is-stream": "^1.1.0", - "@types/node": "^9.4.6", - "@types/node-fetch": "^1.6.7", - "@types/uuid": "^3.4.3", - "fetch-cookie": "^0.7.0", - "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db", + "axios": "^0.18.0", "form-data": "^2.3.2", - "is-buffer": "^2.0.0", - "is-stream": "^1.1.0", - "moment": "^2.21.0", - "url-parse": "^1.2.0", - "uuid": "^3.2.1" - }, - "dependencies": { - "@types/node": { - "version": "9.6.35", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.35.tgz", - "integrity": "sha512-h5zvHS8wXHGa+Gcqs9K8vqCgOtqjr0+NqG/DDJmQIX1wpR9HivAfgV8bjcD3mGM4bPfQw5Aneb2Pn8355L83jA==" - }, - "fetch-ponyfill": { - "version": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db", - "from": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db", - "requires": { - "fetch-cookie": "~0.6.0", - "node-fetch": "~1.7.1" - }, - "dependencies": { - "fetch-cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.6.0.tgz", - "integrity": "sha1-T+xOQIzAAH9sBOVTYYr0s97jf2k=", - "requires": { - "es6-denodeify": "^0.1.1", - "tough-cookie": "^2.3.1" - } - } - } - }, - "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" - } + "tough-cookie": "^2.4.3", + "tslib": "^1.9.2", + "uuid": "^3.2.1", + "xml2js": "^0.4.19" } }, "mstranslator": { @@ -14821,11 +14740,6 @@ "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=" }, - "proto-list": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" - }, "protocols": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.6.tgz", @@ -16178,11 +16092,6 @@ } } }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" - }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -16524,6 +16433,7 @@ "version": "0.5.10", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -16532,7 +16442,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, @@ -17609,73 +17520,11 @@ "semver": "^5.0.1" } }, - "ts-node": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.0.2.tgz", - "integrity": "sha512-MosTrinKmaAcWgO8tqMjMJB22h+sp3Rd1i4fdoWY4mhBDekOwIAKI/bzmRi7IcbCmjquccYg2gcF6NBkLgr0Tw==", - "requires": { - "arg": "^4.1.0", - "diff": "^3.1.0", - "make-error": "^1.1.1", - "source-map-support": "^0.5.6", - "yn": "^3.0.0" - } - }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=" }, - "tslint": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.0.tgz", - "integrity": "sha512-ECOOQRxXCYnUUePG5h/+Z1Zouobk3KFpIHA9aKBB/nnMxs97S1JJPDGt5J4cGm1y9U9VmVlfboOxA8n1kSNzGw==", - "dev": true, - "requires": { - "babel-code-frame": "^6.22.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^3.2.0", - "glob": "^7.1.1", - "js-yaml": "^3.7.0", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.27.2" - } - }, - "tslint-microsoft-contrib": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/tslint-microsoft-contrib/-/tslint-microsoft-contrib-6.0.0.tgz", - "integrity": "sha512-R//efwn+34IUjTJeYgNDAJdzG0jyLWIehygPt/PHuZAieTolFVS56FgeFW7DOLap9ghXzMiFPTmDgm54qaL7QA==", - "dev": true, - "requires": { - "tsutils": "^2.27.2 <2.29.0" - }, - "dependencies": { - "tsutils": { - "version": "2.28.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.28.0.tgz", - "integrity": "sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } - } - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, "tunnel": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", @@ -18039,9 +17888,9 @@ "integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo=" }, "url-parse": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", - "integrity": "sha1-v67kVciJAjIZ11fgRfpqaE7DbBU=", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", "requires": { "querystringify": "^2.0.0", "requires-port": "^1.0.0" @@ -18210,11 +18059,6 @@ } } }, - "whatwg-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", - "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" - }, "whatwg-mimetype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", @@ -18733,11 +18577,6 @@ } } } - }, - "yn": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.0.0.tgz", - "integrity": "sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q==" } } } diff --git a/package.json b/package.json index 810157d2..8c5c757e 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "commit": "git-cz" }, "dependencies": { - "@microsoft/microsoft-graph-client": "1.4.0", + "@microsoft/microsoft-graph-client": "1.5.2", "@semantic-release/exec": "^3.3.2", "adal-node": "0.1.28", "async": "2.6.2", @@ -59,30 +59,31 @@ "azure-arm-website": "5.7.0", "bluebird": "^3.5.3", "body-parser": "1.18.3", - "botbuilder": "4.1.7", - "botbuilder-ai": "4.2.0", - "botbuilder-azure": "4.2.0", + "botbuilder": "4.3.2", + "botbuilder-ai": "4.3.2", + "botbuilder-azure": "4.3.2", "botbuilder-choices": "4.0.0-preview1.2", - "botbuilder-dialogs": "4.2.0", + "botbuilder-dialogs": "4.3.2", "botbuilder-prompts": "4.0.0-preview1.2", "botlib": "^0.1.21", "chai": "4.2.0", "child_process": "^1.0.2", "chokidar": "2.1.2", - "cli-spinner": "^0.2.8", + "cli-spinner": "^0.2.10", "csv-parse": "4.3.3", - "dotenv-extended": "2.3.0", + "dotenv-extended": "2.4.0", "express": "4.16.4", "express-promise-router": "3.0.3", "fs-extra": "7.0.1", "ip": "^1.1.5", - "js-beautify": "^1.8.9", + "js-beautify": "^1.9.0", "localize": "0.4.7", "marked": "0.6.1", "mocha": "6.0.2", "mocha-typescript": "1.1.17", "ms": "2.1.1", "ms-rest-azure": "2.6.0", + "ms-rest-js": "^1.0.1", "nexmo": "2.4.1", "ngrok": "3.1.1", "nyc": "13.3.0", @@ -94,7 +95,7 @@ "request-promise": "4.2.4", "request-promise-native": "1.0.7", "scanf": "^1.0.2", - "sequelize": "4.42.1", + "sequelize": "4.43.0", "sequelize-typescript": "0.6.7", "shx": "0.3.2", "simple-git": "1.107.0", @@ -103,7 +104,7 @@ "swagger-client": "3.8.25", "tedious": "5.0.3", "temperature-js": "^0.1.0", - "ts-node": "8.0.2", + "ts-node": "8.0.3", "typedoc": "0.14.2", "typedoc-plugin-external-module-name": "^2.0.0", "typedoc-plugin-markdown": "^1.1.27", @@ -123,7 +124,7 @@ "@semantic-release/release-notes-generator": "^7.1.4", "@types/chai": "4.1.7", "@types/mocha": "5.2.6", - "@types/sequelize": "4.27.38", + "@types/sequelize": "4.27.39", "@types/url-join": "4.0.0", "@types/winston": "2.4.4", "ban-sensitive-files": "1.9.2", @@ -141,8 +142,8 @@ "standard": "12.0.1", "travis-deploy-once": "5.0.11", "ts-loader": "^5.3.3", - "tslint": "^5.13.0", - "tslint-microsoft-contrib": "^6.0.0" + "tslint": "^5.13.1", + "tslint-microsoft-contrib": "^6.1.0" }, "eslintConfig": { "env": { diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index 21a50978..d385f175 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -36,24 +36,20 @@ 'use strict'; -const UrlJoin = require('url-join'); -import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBDialog } from 'botlib'; +import UrlJoin = require('url-join'); import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBConfigService } from '../../core.gbapp/services/GBConfigService'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; import { GBImporter } from '../../core.gbapp/services/GBImporterService'; -import { GBAdminService } from '../services/GBAdminService'; import { Messages } from '../strings'; /** * Dialogs for administration tasks. */ export class AdminDialog extends IGBDialog { - public static async createFarmCommand(text: any, min: GBMinInstance) {} - - public static async undeployPackageCommand(text: any, min: GBMinInstance) { + public static async undeployPamand(text: any, min: GBMinInstance) { const packageName = text.split(' ')[1]; const importer = new GBImporter(min.core); const deployer = new GBDeployer(min.core, importer); @@ -71,34 +67,27 @@ export class AdminDialog extends IGBDialog { await deployer.deployFromSharePoint(min.instance.instanceId, packageName); } else { const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); - if (!additionalPath) { + if (additionalPath !== undefined) { throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.'); } await deployer.deployPackageFromLocalPath(min, UrlJoin(additionalPath, packageName)); } } - public static async rebuildIndexPackageCommand(min: GBMinInstance, text: string, deployer: GBDeployer) { + public static async rebuildIndexPackageCommand(min: GBMinInstance, deployer: GBDeployer) { await deployer.rebuildIndex( min.instance, new AzureDeployerService(deployer).getKBSearchSchema(min.instance.searchIndex) ); } - public static async addConnectionCommand(min: GBMinInstance, text: any) { - const packageName = text.split(' ')[1]; - const importer = new GBImporter(min.core); - const admin = new GBAdminService(min.core); - // TODO: await admin.addConnection - } - /** * Setup dialogs flows and define services call. * * @param bot The bot adapter. * @param min The minimal bot instance data. */ - public static setup(bot: BotAdapter, min: GBMinInstance) { + public static setup(min: GBMinInstance) { // Setup services. const importer = new GBImporter(min.core); @@ -116,9 +105,9 @@ export class AdminDialog extends IGBDialog { }, async step => { const locale = step.context.activity.locale; - const password = step.result; + const sensitive = step.result; - if (password === GBConfigService.get('ADMIN_PASS')) { + if (sensitive === GBConfigService.get('ADMIN_PASS')) { await step.context.sendActivity(Messages[locale].welcome); return await step.prompt('textPrompt', Messages[locale].which_task); @@ -129,8 +118,9 @@ export class AdminDialog extends IGBDialog { } }, async step => { - const locale = step.context.activity.locale; - const text = step.result; + const locale: string = step.context.activity.locale; + // tslint:disable-next-line:no-unsafe-any + const text: string = step.result; const cmdName = text.split(' ')[0]; step.context.sendActivity(Messages[locale].working(cmdName)); @@ -138,29 +128,16 @@ export class AdminDialog extends IGBDialog { if (text === 'quit') { return await step.replaceDialog('/'); - } else if (cmdName === 'createFarm') { - await AdminDialog.createFarmCommand(text, min); - - return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'deployPackage') { await AdminDialog.deployPackageCommand(min, text, deployer); return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'redeployPackage') { - await AdminDialog.undeployPackageCommand(text, min); await AdminDialog.deployPackageCommand(min, text, deployer); return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'rebuildIndex') { - await AdminDialog.rebuildIndexPackageCommand(min, text, deployer); - - return await step.replaceDialog('/admin', { firstRun: false }); - } else if (cmdName === 'addConnection') { - await AdminDialog.addConnectionCommand(min, text); - - return await step.replaceDialog('/admin', { firstRun: false }); - } else if (cmdName === 'undeployPackage') { - await AdminDialog.undeployPackageCommand(text, min); + await AdminDialog.rebuildIndexPackageCommand(min, deployer); return await step.replaceDialog('/admin', { firstRun: false }); } else if (cmdName === 'setupSecurity') { @@ -224,9 +201,9 @@ export class AdminDialog extends IGBDialog { ); const locale = step.context.activity.locale; - const state = `${min.instance.instanceId}${Math.floor(Math.random() * 1000000000)}`; + const state = `${min.instance.instanceId}${crypto.getRandomValues(new Uint32Array(16))[0]}`; - await min.adminService.setValue(min.instance.instanceId, 'AntiCSRFAttackState', state); + min.adminService.setValue(min.instance.instanceId, 'AntiCSRFAttackState', state); const url = `https://login.microsoftonline.com/${ min.instance.authenticatorTenant diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index 68d3a95d..f844a299 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -38,9 +38,9 @@ import { AuthenticationContext, TokenResponse } from 'adal-node'; import { IGBAdminService, IGBCoreService } from 'botlib'; +import UrlJoin = require('url-join'); import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; import { GuaribasAdmin } from '../models/AdminModel'; -const UrlJoin = require('url-join'); const msRestAzure = require('ms-rest-azure'); const PasswordGenerator = require('strict-password-generator').default; @@ -65,15 +65,13 @@ export class GBAdminService implements IGBAdminService { public static async getADALTokenFromUsername(username: string, password: string) { const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); - const accessToken = credentials.tokenCache._entries[0].accessToken; - return accessToken; + return credentials.tokenCache._entries[0].accessToken; } public static async getADALCredentialsFromUsername(username: string, password: string) { - const credentials = await msRestAzure.loginWithUsernamePassword(username, password); - return credentials; + return await msRestAzure.loginWithUsernamePassword(username, password); } public static getRndPassword(): string { @@ -102,9 +100,8 @@ export class GBAdminService implements IGBAdminService { minimumLength: 12, maximumLength: 14 }; - const name = passwordGenerator.generatePassword(options); - return name; + return passwordGenerator.generatePassword(options); } public async setValue(instanceId: number, key: string, value: string) { @@ -170,7 +167,7 @@ export class GBAdminService implements IGBAdminService { instance.authenticatorClientSecret, resource, async (err, res) => { - if (err) { + if (err !== undefined) { reject(err); } else { const token = res as TokenResponse; diff --git a/packages/analytics.gblib/index.ts b/packages/analytics.gblib/index.ts index 0c3e33f8..91e07bed 100644 --- a/packages/analytics.gblib/index.ts +++ b/packages/analytics.gblib/index.ts @@ -36,18 +36,30 @@ 'use strict'; -const UrlJoin = require('url-join'); - -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; - +import { GBDialogStep, GBMinInstance, IGBCoreService, IGBPackage, GBLog } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; +/** + * .gblib Package handler. + */ export class GBAnalyticsPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} - public unloadPackage(core: IGBCoreService): void {} - public loadBot(min: GBMinInstance): void {} - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { + GBLog.verbose(`loadPackage called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public loadBot(min: GBMinInstance): void { + GBLog.verbose(`loadBot called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } } diff --git a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts b/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts deleted file mode 100644 index 0a41cd43..00000000 --- a/packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts +++ /dev/null @@ -1,69 +0,0 @@ -/*****************************************************************************\ -| ( )_ _ | -| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | -| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | -| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | -| | | ( )_) | | -| (_) \___/' | -| | -| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | -| Licensed under the AGPL-3.0. | -| | -| According to our dual licensing model, this program can be used either | -| under the terms of the GNU Affero General Public License, version 3, | -| or under a proprietary license. | -| | -| The texts of the GNU Affero General Public License with an additional | -| permission and of our proprietary license can be found at and | -| in the LICENSE file you have received along with this program. | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY, without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU Affero General Public License for more details. | -| | -| "General Bots" is a registered trademark of Pragmatismo.io. | -| The licensing of the program under the AGPLv3 does not imply a | -| trademark license. Therefore any rights, title and interest in | -| our trademarks remain entirely with us. | -| | -\*****************************************************************************/ - -/** - * @fileoverview General Bots server core. - */ - -'use strict'; - -import { BotAdapter } from 'botbuilder'; -import { GBMinInstance } from 'botlib'; -import { IGBDialog } from 'botlib'; -import { WaterfallDialog } from 'botlib/node_modules/botbuilder-dialogs'; -import { Messages } from '../strings'; - -export class BotFarmDialog extends IGBDialog { - /** - * Setup dialogs flows and define services call. - * - * @param bot The bot adapter. - * @param min The minimal bot instance data. - */ - public static setup(bot: BotAdapter, min: GBMinInstance) { - min.dialogs.add(new WaterfallDialog ('/createBotFarm', [ - async step => { - const locale = step.context.activity.locale; - await step.prompt('choicePrompt', Messages[locale].what_about_me); - - return step.next(); - }, - async step => { - - const locale = step.context.activity.locale; - await step.context.sendActivity(Messages[locale].thanks); - - return step.next(); - } - ])); - } -} diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index 4d2175ab..dbfe0b18 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -36,8 +36,7 @@ 'use strict'; -import { IGBInstance } from 'botlib'; -import { IGBInstallationDeployer } from 'botlib'; +import { GBLog, IGBInstallationDeployer, IGBInstance } from 'botlib'; import * as fs from 'fs'; import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService'; @@ -47,7 +46,6 @@ const scanf = require('scanf'); * Handles command-line dialog for getting info for Boot Bot. */ export class StartDialog { - public static async createBaseInstance(installationDeployer: IGBInstallationDeployer) { // No .env so asks for cloud credentials to start a new farm. @@ -122,7 +120,7 @@ export class StartDialog { private static retrieveUsername() { let value = GBConfigService.get('CLOUD_USERNAME'); - if (!value) { + if (value !== undefined) { process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_USERNAME:`); value = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -132,7 +130,7 @@ export class StartDialog { private static retrievePassword() { let password = GBConfigService.get('CLOUD_PASSWORD'); - if (!password) { + if (password !== undefined) { process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`); password = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -142,16 +140,13 @@ export class StartDialog { private static retrieveBotId() { let botId = GBConfigService.get('BOT_ID'); - if (!botId) { + if (botId !== undefined) { process.stdout.write( `${GBAdminService.GB_PROMPT}Choose a unique bot Id containing lowercase letters, digits or dashes (cannot use dash as the first two or last one characters), cannot start or end with or contain consecutive dashes and having 4 to 42 characters long.\n` ); process.stdout.write(`${GBAdminService.GB_PROMPT}BOT_ID:`); - - // TODO: Update this regexp to match description of it. - botId = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -160,7 +155,7 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac private static retrieveAuthoringKey() { let authoringKey = GBConfigService.get('NLP_AUTHORING_KEY'); - if (!authoringKey) { + if (authoringKey !== undefined) { process.stdout.write( `${ GBAdminService.GB_PROMPT @@ -184,7 +179,7 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac please go to https://apps.dev.microsoft.com/portal/register-app to generate manually an App ID and App Secret.\n` ); - if (!appId) { + if (appId !== undefined) { process.stdout.write('Generated Application Id (MARKETPLACE_ID):'); appId = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -194,7 +189,7 @@ generate manually an App ID and App Secret.\n` private static retrieveAppPassword() { let appPassword = GBConfigService.get('MARKETPLACE_SECRET'); - if (!appPassword) { + if (appPassword !== undefined) { process.stdout.write('Generated Password (MARKETPLACE_SECRET):'); appPassword = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -207,7 +202,7 @@ generate manually an App ID and App Secret.\n` const map = {}; let index = 1; list.forEach(element => { - console.log(`${index}: ${element.displayName} (${element.subscriptionId})`); + GBLog.info(`${index}: ${element.displayName} (${element.subscriptionId})`); map[index++] = element; }); let subscriptionIndex; @@ -222,8 +217,8 @@ generate manually an App ID and App Secret.\n` private static retrieveLocation() { let location = GBConfigService.get('CLOUD_LOCATION'); - if (!location) { - process.stdout.write('CLOUD_LOCATION (eg. \'westus\'):'); + if (location !== undefined) { + process.stdout.write('CLOUD_LOCATION (eg. westus):'); location = scanf('%s'); } diff --git a/packages/azuredeployer.gbapp/index.ts b/packages/azuredeployer.gbapp/index.ts index 905b43cd..13563ab1 100644 --- a/packages/azuredeployer.gbapp/index.ts +++ b/packages/azuredeployer.gbapp/index.ts @@ -36,19 +36,27 @@ 'use strict'; -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; export class GBAzureDeployerPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} - - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} - - public unloadPackage(core: IGBCoreService): void {} - - public loadBot(min: GBMinInstance): void {} - - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { + GBLog.verbose(`loadPackage called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public loadBot(min: GBMinInstance): void { + GBLog.verbose(`loadBot called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index c0584c00..735b3c27 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -37,14 +37,14 @@ 'use strict'; import { CognitiveServicesManagementClient } from 'azure-arm-cognitiveservices'; -import { CognitiveServicesAccount } from 'azure-arm-cognitiveservices/lib/models'; import { ResourceManagementClient, SubscriptionClient } from 'azure-arm-resource'; import { SearchManagementClient } from 'azure-arm-search'; import { SqlManagementClient } from 'azure-arm-sql'; import { WebSiteManagementClient } from 'azure-arm-website'; +//tslint:disable-next-line:no-submodule-imports import { AppServicePlan } from 'azure-arm-website/lib/models'; -import { IGBInstallationDeployer, IGBInstance } from 'botlib'; -import { HttpMethods, ServiceClient, WebResource } from 'ms-rest-js'; +import { GBLog, IGBInstallationDeployer, IGBInstance } from 'botlib'; +import { HttpHeaders, HttpMethods, ServiceClient, WebResource } from 'ms-rest-js'; import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService'; import { GBCorePackage } from '../../../packages/core.gbapp'; import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService'; @@ -52,10 +52,15 @@ import { GBDeployer } from '../../../packages/core.gbapp/services/GBDeployer'; const Spinner = require('cli-spinner').Spinner; -const UrlJoin = require('url-join'); +// tslint:disable-next-line:no-submodule-imports +import { CognitiveServicesAccount } from 'azure-arm-cognitiveservices/lib/models'; +import UrlJoin = require('url-join'); const iconUrl = 'https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-logo-squared.png'; const publicIp = require('public-ip'); +/** + * Deployer for Microsoft cloud. + */ export class AzureDeployerService implements IGBInstallationDeployer { public apiVersion = '2017-12-01'; public defaultEndPoint = 'http://localhost:4242'; @@ -81,10 +86,10 @@ export class AzureDeployerService implements IGBInstallationDeployer { const req = new WebResource(); req.method = verb; req.url = url; - req.headers = {}; + req.headers = {}; req.headers['Content-Type'] = 'application/json'; req.headers['accept-language'] = '*'; - req.headers.Authorization = 'Bearer ' + accessToken; + req.headers['Authorization'] = `Bearer ${accessToken}`; req.body = body; return req; @@ -192,8 +197,8 @@ export class AzureDeployerService implements IGBInstallationDeployer { } ], scoringProfiles: [], - defaultScoringProfile: null, - corsOptions: null + defaultScoringProfile: undefined, + corsOptions: undefined }; } @@ -218,7 +223,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const url = UrlJoin(baseUrl, query); const req = AzureDeployerService.createRequestObject(url, accessToken, 'PATCH', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); - if (!(res.bodyAsJson as any).id) { + if (!(res['bodyAsJson'] as any).id) { throw res.bodyAsText; } GBLog.info(`Bot proxy updated at: ${endpoint}.`); @@ -250,11 +255,9 @@ export class AzureDeployerService implements IGBInstallationDeployer { const culture = 'en-us'; this.initServices(credentials, subscriptionId); - const spinner = new Spinner('%s'); spinner.start(); spinner.setSpinnerString('|/-\\'); - let keys: any; const name = instance.botId; @@ -313,8 +316,6 @@ export class AzureDeployerService implements IGBInstallationDeployer { instance.textAnalyticsEndpoint = textAnalytics.endpoint; instance.textAnalyticsKey = keys.key1; - // TODO: Check quotes being added when NLP field is filled. - GBLog.info(`Deploying NLP...`); const nlp = await this.createNLP(name, `${name}-nlp`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, nlp.name); @@ -358,7 +359,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { appPassword: string, subscriptionId: string ) { - const instance = {}; + const instance = {}; instance.botId = title; instance.cloudUsername = username; @@ -371,10 +372,9 @@ export class AzureDeployerService implements IGBInstallationDeployer { instance.adminPass = GBAdminService.getRndPassword(); const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); - this.deployFarm(`http://${instance.botId}.azurewebsites.net`, instance, credentials, subscriptionId); - - // TODO: Copy github to webapp. - //const status = await git.status(); + // tslint:disable-next-line:no-http-string + const url = `http://${instance.botId}.azurewebsites.net`; + this.deployFarm(url, instance, credentials, subscriptionId); } private initServices(credentials: any, subscriptionId: string) { @@ -398,21 +398,16 @@ export class AzureDeployerService implements IGBInstallationDeployer { } private async registerProviders(subscriptionId, baseUrl, accessToken) { - const query = `subscriptions/${subscriptionId}/providers/${ - this.provider - }/register?api-version=2018-02-01`; + const query = `subscriptions/${subscriptionId}/providers/${this.provider}/register?api-version=2018-02-01`; const requestUrl = UrlJoin(baseUrl, query); const req = new WebResource(); req.method = 'POST'; req.url = requestUrl; - req.headers = {}; + req.headers = {}; req.headers['Content-Type'] = 'application/json; charset=utf-8'; req.headers['accept-language'] = '*'; - req.headers.Authorization = 'Bearer ' + accessToken; - - const httpClient = new ServiceClient(); - // TODO: Check res for error. + req.headers['Authorization'] = `Bearer ${accessToken}`; } /** @@ -469,7 +464,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { let url = UrlJoin(baseUrl, query); let req = AzureDeployerService.createRequestObject(url, accessToken, 'PUT', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); - if (!(res.bodyAsJson as any).id) { + if (!(res['bodyAsJson'] as any).id) { reject(res.bodyAsText); return; @@ -477,13 +472,14 @@ export class AzureDeployerService implements IGBInstallationDeployer { setTimeout(async () => { try { + //tslint:disable-next-line:max-line-length query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/Microsoft.BotService/botServices/${botId}/channels/WebChatChannel/listChannelWithKeys?api-version=${ this.apiVersion }`; url = UrlJoin(baseUrl, query); req = AzureDeployerService.createRequestObject(url, accessToken, 'GET', JSON.stringify(parameters)); const resChannel = await httpClient.sendRequest(req); - const key = (resChannel.bodyAsJson as any).properties.properties.sites[0].key; + const key = (resChannel['bodyAsJson'] as any).properties.properties.sites[0].key; instance.webchatKey = key; resolve(instance); } catch (error) { @@ -507,8 +503,8 @@ export class AzureDeployerService implements IGBInstallationDeployer { }; const body = JSON.stringify(parameters); - const apps = await this.makeNlpRequest(location, authoringKey, null, 'GET', 'apps'); - const app = (apps.bodyAsJson as any).filter(x => x.name == name)[0]; + const apps = await this.makeNlpRequest(location, authoringKey, undefined, 'GET', 'apps'); + const app = (apps['bodyAsJson'] as any).filter(x => x.name === name)[0]; let id: string; if (!app) { const res = await this.makeNlpRequest(location, authoringKey, body, 'POST', 'apps'); @@ -530,7 +526,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const req = new WebResource(); req.method = method; req.url = `https://${location}.api.cognitive.microsoft.com/luis/api/v2.0/${resource}`; - req.headers = {}; + req.headers = {}; req.headers['Content-Type'] = 'application/json'; req.headers['accept-language'] = '*'; req.headers['Ocp-Apim-Subscription-Key'] = authoringKey; diff --git a/packages/console.gblib/index.ts b/packages/console.gblib/index.ts index 1ee62f9a..b76df96d 100644 --- a/packages/console.gblib/index.ts +++ b/packages/console.gblib/index.ts @@ -36,28 +36,33 @@ 'use strict'; -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { ConsoleDirectLine } from './services/ConsoleDirectLine'; export class GBConsolePackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; public channel: ConsoleDirectLine; - public getDialogs(min: GBMinInstance) {} - - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} - - public unloadPackage(core: IGBCoreService): void {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { + GBLog.verbose(`loadPackage called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } public loadBot(min: GBMinInstance): void { this.channel = new ConsoleDirectLine(min.instance.webchatKey); } - - public unloadBot(min: GBMinInstance): void {} - - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/console.gblib/services/ConsoleDirectLine.ts b/packages/console.gblib/services/ConsoleDirectLine.ts index 56be12e8..9846e1c2 100644 --- a/packages/console.gblib/services/ConsoleDirectLine.ts +++ b/packages/console.gblib/services/ConsoleDirectLine.ts @@ -1,50 +1,58 @@ const Swagger = require('swagger-client'); const rp = require('request-promise'); -import { GBService } from 'botlib'; +import { GBLog, GBService } from 'botlib'; +/** + * Bot simulator in terminal window. + */ export class ConsoleDirectLine extends GBService { - public pollInterval = 1000; - public directLineSecret = ''; - public directLineClientName = 'DirectLineClient'; - public directLineSpecUrl = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json'; + public pollInterval: number = 1000; + public directLineSecret: string = ''; + public directLineClientName: string = 'DirectLineClient'; + public directLineSpecUrl: string = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json'; - constructor(directLineSecret) { + constructor(directLineSecret: string) { super(); this.directLineSecret = directLineSecret; - + // tslint:disable-next-line:no-unsafe-any const directLineClient = rp(this.directLineSpecUrl) - .then(function(spec) { + .then((spec: string) => { + // tslint:disable-next-line:no-unsafe-any return new Swagger({ spec: JSON.parse(spec.trim()), usePromise: true }); }) - .then(function(client) { + .then(client => { + // tslint:disable-next-line:no-unsafe-any client.clientAuthorizations.add( 'AuthorizationBotConnector', - new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header') + // tslint:disable-next-line:no-unsafe-any + new Swagger.ApiKeyAuthorization('Authorization', `Bearer ${directLineSecret}`, 'header') ); return client; }) - .catch(function(err) { - console.error('Error initializing DirectLine client', err); + .catch(err => { + GBLog.error(`Error initializing DirectLine client ${err}`); }); - // TODO: Remove *this* issue. const _this_ = this; + // tslint:disable-next-line:no-unsafe-any directLineClient.then(client => { + // tslint:disable-next-line:no-unsafe-any client.Conversations.Conversations_StartConversation() - .then(function(response) { + .then(response => { + // tslint:disable-next-line:no-unsafe-any return response.obj.conversationId; }) - .then(function(conversationId) { + .then(conversationId => { _this_.sendMessagesFromConsole(client, conversationId); _this_.pollMessages(client, conversationId); }) - .catch(function(err) { - console.error('Error starting conversation', err); + .catch(err => { + GBLog.error(`Error starting conversation ${err}`); }); }); } @@ -54,14 +62,16 @@ export class ConsoleDirectLine extends GBService { process.stdin.resume(); const stdin = process.stdin; process.stdout.write('Command> '); - stdin.addListener('data', function(e) { - const input = e.toString().trim(); - if (input) { + stdin.addListener('data', e => { + // tslint:disable-next-line:no-unsafe-any + const input: string = e.toString().trim(); + if (input !== undefined) { // exit if (input.toLowerCase() === 'exit') { return process.exit(); } + // tslint:disable-next-line:no-unsafe-any client.Conversations.Conversations_PostActivity({ conversationId: conversationId, activity: { @@ -73,8 +83,8 @@ export class ConsoleDirectLine extends GBService { name: _this_.directLineClientName } } - }).catch(function(err) { - console.error('Error sending message:', err); + }).catch(err => { + GBLog.error(`Error sending message: ${err}`); }); process.stdout.write('Command> '); @@ -82,71 +92,85 @@ export class ConsoleDirectLine extends GBService { }); } - /** TBD: Poll Messages from conversation using DirectLine client */ public pollMessages(client, conversationId) { const _this_ = this; - console.log('Starting polling message for conversationId: ' + conversationId); - let watermark = null; - setInterval(function() { + GBLog.info(`Starting polling message for conversationId: ${conversationId}`); + let watermark; + setInterval(() => { + // tslint:disable-next-line:no-unsafe-any client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark }) - .then(function(response) { + .then(response => { + // tslint:disable-next-line:no-unsafe-any watermark = response.obj.watermark; + // tslint:disable-next-line:no-unsafe-any return response.obj.activities; }) .then(_this_.printMessages, _this_.directLineClientName); + // tslint:disable-next-line:align }, this.pollInterval); } + // tslint:disable:no-unsafe-any public printMessages(activities, directLineClientName) { if (activities && activities.length) { // ignore own messages - activities = activities.filter(function(m) { + activities = activities.filter(m => { return m.from.id !== directLineClientName; }); if (activities.length) { // print other messages activities.forEach(activity => { - console.log(activity.text); + GBLog.info(activity.text); + // tslint:disable-next-line:align }, this); process.stdout.write('Command> '); } } } + // tslint:enable:no-unsafe-any + // tslint:disable:no-unsafe-any public printMessage(activity) { if (activity.text) { - console.log(activity.text); + GBLog.info(activity.text); } if (activity.attachments) { - activity.attachments.forEach(function(attachment) { + activity.attachments.forEach(attachment => { switch (attachment.contentType) { case 'application/vnd.microsoft.card.hero': this.renderHeroCard(attachment); break; case 'image/png': - console.log('Opening the requested image ' + attachment.contentUrl); + GBLog.info(`Opening the requested image ${attachment.contentUrl}`); open(attachment.contentUrl); break; + + default: + GBLog.info(`Unknown contentType: ${attachment.contentType}`); + break; } }); } } + // tslint:enable:no-unsafe-any + // tslint:disable:no-unsafe-any public renderHeroCard(attachment) { const width = 70; - const contentLine = function(content) { - return ' '.repeat((width - content.length) / 2) + content + ' '.repeat((width - content.length) / 2); + const contentLine = content => { + return `${' '.repeat((width - content.length) / 2)}content${' '.repeat((width - content.length) / 2)}`; }; - console.log('/' + '*'.repeat(width + 1)); - console.log('*' + contentLine(attachment.content.title) + '*'); - console.log('*' + ' '.repeat(width) + '*'); - console.log('*' + contentLine(attachment.content.text) + '*'); - console.log('*'.repeat(width + 1) + '/'); + GBLog.info(`/${'*'.repeat(width + 1)}`); + GBLog.info(`*${contentLine(attachment.content.title)}*`); + GBLog.info(`*${' '.repeat(width)}*`); + GBLog.info(`*${contentLine(attachment.content.text)}*`); + GBLog.info(`${'*'.repeat(width + 1)}/`); } + // tslint:enable:no-unsafe-any } diff --git a/packages/core.gbapp/index.ts b/packages/core.gbapp/index.ts index 3e73cba4..94f227cb 100644 --- a/packages/core.gbapp/index.ts +++ b/packages/core.gbapp/index.ts @@ -36,9 +36,9 @@ 'use strict'; -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); -import { GBMinInstance, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBPackage, GBLog, GBDialogStep } from 'botlib'; import { IGBCoreService } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; @@ -49,19 +49,25 @@ import { GuaribasChannel, GuaribasException, GuaribasInstance, GuaribasPackage } export class GBCorePackage implements IGBPackage { public static CurrentEngineName = 'guaribas-1.0.0'; public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasInstance, GuaribasPackage, GuaribasChannel, GuaribasException]); } - public unloadPackage(core: IGBCoreService): void {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } public loadBot(min: GBMinInstance): void { WelcomeDialog.setup(min.bot, min); WhoAmIDialog.setup(min.bot, min); } - - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/core.gbapp/services/GBAPIService.ts b/packages/core.gbapp/services/GBAPIService.ts index dccd0f39..03ddc01b 100644 --- a/packages/core.gbapp/services/GBAPIService.ts +++ b/packages/core.gbapp/services/GBAPIService.ts @@ -34,12 +34,12 @@ import { TurnContext } from 'botbuilder'; import { WaterfallStepContext } from 'botbuilder-dialogs'; -import { GBMinInstance } from 'botlib'; +import { GBLog, GBMinInstance } from 'botlib'; import * as request from 'request-promise-native'; +import UrlJoin = require('url-join'); import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBDeployer } from './GBDeployer'; -const UrlJoin = require('url-join'); /** * BASIC system class for extra manipulation of bot behaviour. @@ -64,14 +64,14 @@ class SysClass { } public async createABotFarmUsing( - botId, - username, - password, - location, - nlpAuthoringKey, - appId, - appPassword, - subscriptionId + botId: string, + username: string, + password: string, + location: string, + nlpAuthoringKey: string, + appId: string, + appPassword: string, + subscriptionId: string ) { const service = new AzureDeployerService(this.deployer); await service.deployToCloud( @@ -91,7 +91,7 @@ class SysClass { */ public async sendEmail(to, subject, body) { // tslint:disable-next-line:no-console - console.log(`[E-mail]: to:${to}, subject: ${subject}, body: ${body}.`); + GBLog.info(`[E-mail]: to:${to}, subject: ${subject}, body: ${body}.`); } /** diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index e3e58e0e..0b13d92e 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -30,8 +30,8 @@ | | \*****************************************************************************/ - import * as fs from 'fs'; +import { GBLog } from 'botlib'; /** * @fileoverview General Bots server core. @@ -49,7 +49,7 @@ export class GBConfigService { overrideProcessEnv: true }); } catch (e) { - console.error(e.message); + GBLog.error(e.message); process.exit(3); } } diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 5d4e501a..e5e4c184 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -63,7 +63,7 @@ export class GBConversationalService implements IGBConversationalService { return step.context.activity.locale; } - public async sendEvent(step: GBDialogStep, name: string, value: any): Promise { + public async sendEvent(step: GBDialogStep, name: string, value: Object): Promise { if (step.context.activity.channelId === 'webchat') { const msg = MessageFactory.text(''); msg.value = value; diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index c5dd11f0..8d1d70b8 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -36,16 +36,15 @@ 'use strict'; - const Path = require('path'); -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); const Fs = require('fs'); const WaitUntil = require('wait-until'); const express = require('express'); const child_process = require('child_process'); const graph = require('@microsoft/microsoft-graph-client'); -import { GBMinInstance, IGBCoreService, IGBInstance } from 'botlib'; +import { GBMinInstance, IGBCoreService, IGBInstance, GBLog } from 'botlib'; import { GBError, IGBPackage } from 'botlib'; import { AzureSearch } from 'pragmatismo-io-framework'; import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; diff --git a/packages/core.gbapp/services/GBImporterService.ts b/packages/core.gbapp/services/GBImporterService.ts index 9464d60b..515296dd 100644 --- a/packages/core.gbapp/services/GBImporterService.ts +++ b/packages/core.gbapp/services/GBImporterService.ts @@ -36,10 +36,10 @@ 'use strict'; -const UrlJoin = require('url-join'); import { IGBCoreService, IGBInstance } from 'botlib'; import fs = require('fs'); import path = require('path'); +import UrlJoin = require('url-join'); import { SecService } from '../../security.gblib/services/SecService'; import { GuaribasInstance } from '../models/GBModel'; diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 862c54f5..fa6471c6 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -37,7 +37,7 @@ 'use strict'; const { DialogSet, TextPrompt } = require('botbuilder-dialogs'); -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); const express = require('express'); const request = require('request-promise-native'); diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index 35e477c8..715fab13 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -41,11 +41,11 @@ import { TSCompiler } from './TSCompiler'; const walkPromise = require('walk-promise'); const vm = require('vm'); -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); +import DialogClass from './GBAPIService'; const vb2ts = require('vbscript-to-typescript/dist/converter'); const beautify = require('js-beautify').js; - /** * @fileoverview Virtualization services for emulation of BASIC. * This alpha version is using a hack in form of converter to @@ -249,7 +249,7 @@ export class GBVMService extends GBService { min.dialogs.add( new WaterfallDialog('/hear', [ async step => { - step.activeDialog.state.cbId = step.options.id; + step.activeDialog.state.cbId = step.options['id']; return await step.prompt('textPrompt', {}); }, @@ -259,7 +259,7 @@ export class GBVMService extends GBService { const cbId = step.activeDialog.state.cbId; const cb = min.cbMap[cbId]; - cb.bind({ step: step: GBDialogStep, context: step.context }); // TODO: Necessary or min.sandbox? + cb.bind({ step: step, context: step.context }); // TODO: Necessary or min.sandbox? await step.endDialog(); diff --git a/packages/core.gbapp/services/TSCompiler.ts b/packages/core.gbapp/services/TSCompiler.ts index c1cc88da..ccb991ab 100644 --- a/packages/core.gbapp/services/TSCompiler.ts +++ b/packages/core.gbapp/services/TSCompiler.ts @@ -38,7 +38,6 @@ import * as ts from 'typescript'; - export class TSCompiler { private static shouldIgnoreError(diagnostic) { diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index 96cdd6e7..e66d26e7 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -86,7 +86,7 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].about_suggestions); - step.activeDialog.state.cbId = step.options['id']; + step.activeDialog.state.cbId = step.options.id; return await step.prompt('textPrompt', Messages[locale].what_about_service); }, diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index 21b8bc01..02eab81e 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -44,7 +44,6 @@ import { GBMinInstance } from 'botlib'; import { CSService } from '../services/CSService'; import { Messages } from '../strings'; - export class QualityDialog extends IGBDialog { /** * Setup dialogs flows and define services call. diff --git a/packages/customer-satisfaction.gbapp/index.ts b/packages/customer-satisfaction.gbapp/index.ts index 42898ba7..3850b5d9 100644 --- a/packages/customer-satisfaction.gbapp/index.ts +++ b/packages/customer-satisfaction.gbapp/index.ts @@ -36,8 +36,8 @@ 'use strict'; -const UrlJoin = require('url-join'); -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; +import UrlJoin = require('url-join'); import { FeedbackDialog } from './dialogs/FeedbackDialog'; import { QualityDialog } from './dialogs/QualityDialog'; import { GuaribasQuestionAlternate } from './models/index'; @@ -46,16 +46,24 @@ import { Sequelize } from 'sequelize-typescript'; export class GBCustomerSatisfactionPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasQuestionAlternate]); } - public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { FeedbackDialog.setup(min.bot, min); QualityDialog.setup(min.bot, min); } - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index fc95465d..5be2cace 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -38,14 +38,12 @@ import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { IGBDialog } from 'botlib'; +import { IGBDialog, GBLog } from 'botlib'; import { GBMinInstance } from 'botlib'; import { AzureText } from 'pragmatismo-io-framework'; import { Messages } from '../strings'; import { KBService } from './../services/KBService'; - - export class AskDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -59,13 +57,13 @@ export class AskDialog extends IGBDialog { min.dialogs.add( new WaterfallDialog('/answerEvent', [ async step => { - if (step.options && step.options.questionId) { - const question = await service.getQuestionById(min.instance.instanceId, step.options.questionId); + if (step.options && step.options['questionId']) { + const question = await service.getQuestionById(min.instance.instanceId, step.options['questionId']); const answer = await service.getAnswerById(min.instance.instanceId, question.answerId); // Sends the answer to all outputs, including projector. - await service.sendAnswer(min.conversationalService, step: GBDialogStep, answer); + await service.sendAnswer(min.conversationalService, step, answer); await step.replaceDialog('/ask', { isReturning: true }); } @@ -79,7 +77,7 @@ export class AskDialog extends IGBDialog { new WaterfallDialog('/answer', [ async step => { const user = await min.userProfile.get(step.context, {}); - let text = step.options.query; + let text = step.options['query']; if (!text) { throw new Error(`/answer being called with no args query text.`); } @@ -88,13 +86,13 @@ export class AskDialog extends IGBDialog { // Stops any content on projector. - await min.conversationalService.sendEvent(step: GBDialogStep, 'stop', null); + await min.conversationalService.sendEvent(step, 'stop', null); // Handle extra text from FAQ. - if (step.options && step.options.query) { - text = step.options.query; - } else if (step.options && step.options.fromFaq) { + if (step.options && step.options['query']) { + text = step.options['query']; + } else if (step.options && step.options['fromFaq']) { await step.context.sendActivity(Messages[locale].going_answer); } @@ -126,7 +124,7 @@ export class AskDialog extends IGBDialog { // Sends the answer to all outputs, including projector. - await service.sendAnswer(min.conversationalService, step: GBDialogStep, resultsA.answer); + await service.sendAnswer(min.conversationalService, step, resultsA.answer); // Goes to ask loop, again. @@ -155,11 +153,11 @@ export class AskDialog extends IGBDialog { // Sends the answer to all outputs, including projector. - await service.sendAnswer(min.conversationalService, step: GBDialogStep, resultsB.answer); + await service.sendAnswer(min.conversationalService, step, resultsB.answer); return await step.replaceDialog('/ask', { isReturning: true }); } else { - if (!(await min.conversationalService.routeNLP(step: GBDialogStep, min, text))) { + if (!(await min.conversationalService.routeNLP(step, min, text))) { await step.context.sendActivity(Messages[locale].did_not_find); return await step.replaceDialog('/ask', { isReturning: true }); @@ -183,9 +181,9 @@ export class AskDialog extends IGBDialog { // Three forms of asking. - if (step.options && step.options.firstTime) { + if (step.options && step.options['firstTime'] ) { text = Messages[locale].ask_first_time; - } else if (step.options && step.options.isReturning) { + } else if (step.options && step.options['isReturning']) { text = Messages[locale].anything_else; } else if (user.subjects.length > 0) { text = Messages[locale].which_question; diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts index 6505ccfe..b020c189 100644 --- a/packages/kb.gbapp/dialogs/MenuDialog.ts +++ b/packages/kb.gbapp/dialogs/MenuDialog.ts @@ -37,7 +37,7 @@ 'use strict'; -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); import { BotAdapter, CardFactory, MessageFactory } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; @@ -63,8 +63,8 @@ export class MenuDialog extends IGBDialog { const locale = step.context.activity.locale; let rootSubjectId = null; - if (step.options && step.options.data) { - const subject = step.options.data; + if (step.options && step.options['data']) { + const subject = step.options ['data']; // If there is a shortcut specified as subject destination, go there. @@ -89,7 +89,7 @@ export class MenuDialog extends IGBDialog { 'menu', user.subjects ); - await min.conversationalService.sendEvent(step: GBDialogStep, 'play', { + await min.conversationalService.sendEvent(step, 'play', { playerType: 'bullet', data: data.slice(0, 10) }); diff --git a/packages/kb.gbapp/index.ts b/packages/kb.gbapp/index.ts index 4f5af31a..628c035e 100644 --- a/packages/kb.gbapp/index.ts +++ b/packages/kb.gbapp/index.ts @@ -36,9 +36,9 @@ 'use strict'; -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); -import { GBMinInstance, IGBPackage } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBPackage } from 'botlib'; import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from './models/index'; import { IGBCoreService } from 'botlib'; @@ -49,17 +49,25 @@ import { MenuDialog } from './dialogs/MenuDialog'; export class GBKBPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasAnswer, GuaribasQuestion, GuaribasSubject]); } - public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { AskDialog.setup(min.bot, min); FaqDialog.setup(min.bot, min); MenuDialog.setup(min.bot, min); } - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index c6ceda5d..70250f14 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -34,32 +34,38 @@ * @fileoverview Knowledge base services and logic. */ - const Path = require('path'); const Fs = require('fs'); - -const parse = require('bluebird').promisify(require('csv-parse')); -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); const marked = require('marked'); const path = require('path'); const asyncPromise = require('async-promises'); const walkPromise = require('walk-promise'); -import { Messages } from '../strings'; +// tslint:disable:no-unsafe-any +const parse = require('bluebird').promisify(require('csv-parse')); +// tslint:enable:no-unsafe-any -import { IGBConversationalService, IGBCoreService, IGBInstance } from 'botlib'; +import { GBDialogStep, GBLog, IGBConversationalService, IGBCoreService, IGBInstance } from 'botlib'; import { AzureSearch } from 'pragmatismo-io-framework'; import { Sequelize } from 'sequelize-typescript'; import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GuaribasPackage } from '../../core.gbapp/models/GBModel'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from '../models'; +import { Messages } from '../strings'; import { GBConfigService } from './../../core.gbapp/services/GBConfigService'; +/** + * Result for quey on KB data. + */ export class KBServiceSearchResults { public answer: GuaribasAnswer; public questionId: number; } +/** + * All services related to knowledge base management. + */ export class KBService { public sequelize: Sequelize; @@ -68,7 +74,7 @@ export class KBService { } public static getFormattedSubjectItems(subjects: GuaribasSubject[]) { - if (!subjects) { + if (subjects !== null) { return ''; } const out = []; @@ -116,7 +122,7 @@ export class KBService { } }); - if (question) { + if (question !== null) { const answer = await GuaribasAnswer.findOne({ where: { instanceId: instanceId, @@ -127,7 +133,7 @@ export class KBService { return Promise.resolve({ question: question, answer: answer }); } - return Promise.resolve(null); + return Promise.resolve(undefined); } public async addAnswer(obj: GuaribasAnswer): Promise { @@ -157,40 +163,39 @@ export class KBService { query = query.replace('/', ' '); query = query.replace('\\', ' '); - if (subjects) { + if (subjects !== null) { const text = KBService.getSubjectItemsSeparatedBySpaces(subjects); - if (text) { + if (text !== null) { query = `${query} ${text}`; } } query = `${query}&$filter=instanceId eq ${instance.instanceId}`; - try { - if (instance.searchKey && GBConfigService.get('STORAGE_DIALECT') === 'mssql') { - const service = new AzureSearch( - instance.searchKey, - instance.searchHost, - instance.searchIndex, - instance.searchIndexer - ); - const results = await service.search(query); - if (results && results.length > 0 && results[0]['@search.score'] >= searchScore) { - const value = await this.getAnswerById(instance.instanceId, results[0].answerId); - if (value) { - return Promise.resolve({ answer: value, questionId: results[0].questionId }); - } else { - return Promise.resolve({ answer: null, questionId: 0 }); - } - } - } else { - const data = await this.getAnswerByText(instance.instanceId, query); - if (data) { - return Promise.resolve({ answer: data.answer, questionId: data.question.questionId }); + + // tslint:disable:no-unsafe-any + if (instance.searchKey !== null && GBConfigService.get('STORAGE_DIALECT') === 'mssql') { + const service = new AzureSearch( + instance.searchKey, + instance.searchHost, + instance.searchIndex, + instance.searchIndexer + ); + const results = await service.search(query); + + if (results && results.length > 0 && results[0]['@search.score'] >= searchScore) { + const value = await this.getAnswerById(instance.instanceId, results[0].answerId); + if (value !== null) { + return Promise.resolve({ answer: value, questionId: results[0].questionId }); } else { - return Promise.resolve({ answer: null, questionId: 0 }); + return Promise.resolve({ answer: undefined, questionId: 0 }); } } - } catch (reason) { - return Promise.reject(new Error(reason)); + } else { + const data = await this.getAnswerByText(instance.instanceId, query); + if (data) { + return Promise.resolve({ answer: data.answer, questionId: data.question.questionId }); + } else { + return Promise.resolve({ answer: undefined, questionId: 0 }); + } } } @@ -203,14 +208,13 @@ export class KBService { } public async getFaqBySubjectArray(from: string, subjects: any): Promise { - if (subjects) { const where = { from: from, - subject1: null, - subject2: null, - subject3: null, - subject4: null + subject1: undefined, + subject2: undefined, + subject3: undefined, + subject4: undefined }; if (subjects[0]) { @@ -291,13 +295,13 @@ export class KBService { let indexer = 0; subjectArray.forEach(element => { - if (indexer == 0) { + if (indexer === 0) { subject1 = subjectArray[indexer].substring(0, 63); - } else if (indexer == 1) { + } else if (indexer === 1) { subject2 = subjectArray[indexer].substring(0, 63); - } else if (indexer == 2) { + } else if (indexer === 2) { subject3 = subjectArray[indexer].substring(0, 63); - } else if (indexer == 3) { + } else if (indexer === 3) { subject4 = subjectArray[indexer].substring(0, 63); } indexer++; @@ -310,7 +314,7 @@ export class KBService { content: answer, format: format, packageId: packageId, - prevId: lastQuestionId ? lastQuestionId : 0 + prevId: lastQuestionId !== null ? lastQuestionId : 0 }); const question1 = await GuaribasQuestion.create({ @@ -326,7 +330,7 @@ export class KBService { packageId: packageId }); - if (lastAnswer && lastQuestionId) { + if (lastAnswer !== null && lastQuestionId !== 0) { await lastAnswer.update({ nextId: lastQuestionId }); } lastAnswer = answer1; @@ -336,21 +340,21 @@ export class KBService { } else { // Skips the header. - return Promise.resolve(null); + return Promise.resolve(undefined); } }); } public async sendAnswer(conversationalService: IGBConversationalService, step: GBDialogStep, answer: GuaribasAnswer) { if (answer.content.endsWith('.mp4')) { - await conversationalService.sendEvent(step: GBDialogStep, 'play', { + await conversationalService.sendEvent(step, 'play', { playerType: 'video', data: answer.content }); - } else if (answer.content.length > 140 && step.context._activity.channelId === 'webchat') { + } else if (answer.content.length > 140 && step.context.activity.channelId === 'webchat') { const locale = step.context.activity.locale; - await step.context.sendActivity(Messages[locale].will_answer_projector); // TODO: Handle rnd. + await step.context.sendActivity(Messages[locale].will_answer_projector); let html = answer.content; if (answer.format === '.md') { @@ -367,7 +371,7 @@ export class KBService { }); html = marked(answer.content); } - await conversationalService.sendEvent(step: GBDialogStep, 'play', { + await conversationalService.sendEvent(step, 'play', { playerType: 'markdown', data: { content: html, @@ -378,7 +382,7 @@ export class KBService { }); } else { await step.context.sendActivity(answer.content); - await conversationalService.sendEvent(step: GBDialogStep, 'stop', null); + await conversationalService.sendEvent(step, 'stop', undefined); } } @@ -409,12 +413,10 @@ export class KBService { } public async importSubjectFile(packageId: number, filename: string, instance: IGBInstance): Promise { - const subjects = JSON.parse(Fs.readFileSync(filename, 'utf8')); + const subjectsLoaded = JSON.parse(Fs.readFileSync(filename, 'utf8')); const doIt = async (subjects: GuaribasSubject[], parentSubjectId: number) => { return asyncPromise.eachSeries(subjects, async item => { - const mediaFilename = item.id + '.png'; - const value = await GuaribasSubject.create({ internalId: item.id, parentSubjectId: parentSubjectId, @@ -434,7 +436,7 @@ export class KBService { }); }; - return doIt(subjects.children, null); + return doIt(subjectsLoaded.children, undefined); } public async undeployKbFromStorage(instance: IGBInstance, deployer: GBDeployer, packageId: number) { diff --git a/packages/security.gblib/index.ts b/packages/security.gblib/index.ts index 12133320..cd54966f 100644 --- a/packages/security.gblib/index.ts +++ b/packages/security.gblib/index.ts @@ -36,25 +36,32 @@ 'use strict'; -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models'; export class GBSecurityPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; - public getDialogs(min: GBMinInstance) {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public loadBot(min: GBMinInstance): void { + GBLog.verbose(`loadBot called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasGroup, GuaribasUser, GuaribasUserGroup]); } - - public unloadPackage(core: IGBCoreService): void {} - - public loadBot(min: GBMinInstance): void {} - - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} } diff --git a/packages/security.gblib/services/SecService.ts b/packages/security.gblib/services/SecService.ts index 8ced609b..d1fee375 100644 --- a/packages/security.gblib/services/SecService.ts +++ b/packages/security.gblib/services/SecService.ts @@ -1,5 +1,5 @@ const Fs = require('fs'); -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); import { GBService, IGBInstance } from 'botlib'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from '../models'; diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts index 6a0ca8a9..fbb4e983 100644 --- a/packages/whatsapp.gblib/index.ts +++ b/packages/whatsapp.gblib/index.ts @@ -36,9 +36,9 @@ 'use strict'; -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { WhatsappDirectLine } from './services/WhatsappDirectLine'; @@ -47,11 +47,6 @@ export class GBWhatsappPackage implements IGBPackage { public sysPackages: IGBPackage[] = undefined; public channel: WhatsappDirectLine; - public getDialogs(min: GBMinInstance) {} - - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {} - - public unloadPackage(core: IGBCoreService): void {} public loadBot(min: GBMinInstance): void { // Only loads engine if it is defined on services.json. @@ -68,6 +63,9 @@ export class GBWhatsappPackage implements IGBPackage { } } - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} + public getDialogs(min: GBMinInstance) {GBLog.verbose (`getDialogs called.`);} + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {GBLog.verbose (`loadPackage called.`);} + public unloadPackage(core: IGBCoreService): void {GBLog.verbose (`unloadPackage called.`);} + public unloadBot(min: GBMinInstance): void {GBLog.verbose (`unloadBot called.`);} + public onNewSession(min: GBMinInstance, step: GBDialogStep): void {GBLog.verbose (`onNewSession called.`);} } diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index befb941c..c3d61aaf 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -1,8 +1,8 @@ -const UrlJoin = require('url-join'); +import UrlJoin = require('url-join'); const Swagger = require('swagger-client'); const rp = require('request-promise'); -import { GBService } from 'botlib'; +import { GBService, GBLog } from 'botlib'; import * as request from 'request-promise-native'; export class WhatsappDirectLine extends GBService { @@ -67,13 +67,13 @@ export class WhatsappDirectLine extends GBService { const result = await request.post(options); GBLog.info(result); } catch (error) { - GBLog.error('Error initializing 3rd party Whatsapp provider.', error); + GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error}`); } return client; }) .catch(err => { - GBLog.error('Error initializing DirectLine client', err); + GBLog.error(`Error initializing 3rd party Whatsapp provider(2) ${err}`); }); } @@ -104,7 +104,7 @@ export class WhatsappDirectLine extends GBService { this.pollMessages(client, conversationId, from, fromName); }) .catch(err => { - console.error('Error starting conversation', err); + GBLog.error(`Error starting conversation ${err}`); }); } else { this.inputMessage(client, conversationId, text, from, fromName); diff --git a/tslint.json b/tslint.json index 7480486c..10699ef4 100644 --- a/tslint.json +++ b/tslint.json @@ -12,6 +12,8 @@ "rulesDirectory": ["node_modules/tslint-microsoft-contrib"], "jsRules": {}, "rules": { + "no-unsafe-any":false, + "newline-per-chained-call": false, "no-floating-promises": false, "no-var-requires": false, "typedef": false, @@ -24,6 +26,7 @@ "no-redundant-jsdoc": false, "no-return-await": false, "prefer-type-cast": false, + "non-literal-fs-path": false, "no-object-literal-type-assertion": false, "no-increment-decrement": false, "no-any": false, From e9bed772fafa0b7f4e45948adc919e8e334d520e Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Fri, 8 Mar 2019 19:18:39 -0300 Subject: [PATCH 22/32] fix(general): tslint being applied in all sources. --- packages/admin.gbapp/index.ts | 4 ++-- packages/core.gbapp/dialogs/WhoAmIDialog.ts | 2 +- packages/core.gbapp/services/TSCompiler.ts | 1 + .../customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts | 2 +- packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts | 2 +- packages/kb.gbapp/dialogs/FaqDialog.ts | 2 +- src/app.ts | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/admin.gbapp/index.ts b/packages/admin.gbapp/index.ts index 802fa41b..cfd99bed 100644 --- a/packages/admin.gbapp/index.ts +++ b/packages/admin.gbapp/index.ts @@ -36,7 +36,7 @@ 'use strict'; -import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import { GBMinInstance, IGBCoreService, IGBPackage, GBDialogStep } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { AdminDialog } from './dialogs/AdminDialog'; import { GuaribasAdmin } from './models/AdminModel'; @@ -54,6 +54,6 @@ export class GBAdminPackage implements IGBPackage { } public loadBot(min: GBMinInstance): void { - AdminDialog.setup(min.bot, min); + AdminDialog.setup(min); } } diff --git a/packages/core.gbapp/dialogs/WhoAmIDialog.ts b/packages/core.gbapp/dialogs/WhoAmIDialog.ts index 7b20eddc..20d7162e 100644 --- a/packages/core.gbapp/dialogs/WhoAmIDialog.ts +++ b/packages/core.gbapp/dialogs/WhoAmIDialog.ts @@ -57,7 +57,7 @@ export class WhoAmIDialog extends IGBDialog { if (min.instance.whoAmIVideo) { await step.context.sendActivity(Messages[locale].show_video); - await min.conversationalService.sendEvent(step: GBDialogStep, 'play', { + await min.conversationalService.sendEvent(step, 'play', { playerType: 'video', data: min.instance.whoAmIVideo.trim() }); diff --git a/packages/core.gbapp/services/TSCompiler.ts b/packages/core.gbapp/services/TSCompiler.ts index ccb991ab..7d5185e8 100644 --- a/packages/core.gbapp/services/TSCompiler.ts +++ b/packages/core.gbapp/services/TSCompiler.ts @@ -37,6 +37,7 @@ 'use strict'; import * as ts from 'typescript'; +import { GBLog } from 'botlib'; export class TSCompiler { diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index e66d26e7..96cdd6e7 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -86,7 +86,7 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].about_suggestions); - step.activeDialog.state.cbId = step.options.id; + step.activeDialog.state.cbId = step.options['id']; return await step.prompt('textPrompt', Messages[locale].what_about_service); }, diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index 02eab81e..09b962fd 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -62,7 +62,7 @@ export class QualityDialog extends IGBDialog { const score = step.result; setTimeout( - () => min.conversationalService.sendEvent(step: GBDialogStep, 'stop', null), + () => min.conversationalService.sendEvent(step, 'stop', null), 400 ); diff --git a/packages/kb.gbapp/dialogs/FaqDialog.ts b/packages/kb.gbapp/dialogs/FaqDialog.ts index f837e4cd..f2c18ebb 100644 --- a/packages/kb.gbapp/dialogs/FaqDialog.ts +++ b/packages/kb.gbapp/dialogs/FaqDialog.ts @@ -59,7 +59,7 @@ export class FaqDialog extends IGBDialog { const data = await service.getFaqBySubjectArray('faq', null); const locale = step.context.activity.locale; if (data) { - await min.conversationalService.sendEvent(step: GBDialogStep, 'play', { + await min.conversationalService.sendEvent(step, 'play', { playerType: 'bullet', data: data.slice(0, 10) }); diff --git a/src/app.ts b/src/app.ts index 3f913f5e..a5b0ba64 100644 --- a/src/app.ts +++ b/src/app.ts @@ -40,7 +40,7 @@ const logger = require('./logger'); const express = require('express'); const bodyParser = require('body-parser'); -import { IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; +import { IGBCoreService, IGBInstance, IGBPackage, GBLog } from 'botlib'; import { GBAdminService } from '../packages/admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../packages/azuredeployer.gbapp/services/AzureDeployerService'; import { GuaribasInstance } from '../packages/core.gbapp/models/GBModel'; From 8fec26ce037cf410a9684d3f0afeebce84414a5c Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sat, 9 Mar 2019 16:59:31 -0300 Subject: [PATCH 23/32] fix(general): tslint being applied in all sources. --- package-lock.json | 618 ++++++++++++++---- package.json | 8 +- packages/admin.gbapp/dialogs/AdminDialog.ts | 14 +- packages/admin.gbapp/index.ts | 25 +- packages/admin.gbapp/models/AdminModel.ts | 5 +- .../admin.gbapp/services/GBAdminService.ts | 15 +- packages/admin.gbapp/strings.ts | 3 +- packages/analytics.gblib/index.ts | 6 +- packages/analytics.gblib/models/index.ts | 94 +-- .../services/AnalyticsService.ts | 7 +- .../dialogs/StartDialog.ts | 2 +- packages/azuredeployer.gbapp/index.ts | 9 +- .../services/AzureDeployerService.ts | 27 +- packages/console.gblib/index.ts | 12 +- packages/core.gbapp/dialogs/WelcomeDialog.ts | 14 +- packages/core.gbapp/dialogs/WhoAmIDialog.ts | 11 +- packages/core.gbapp/index.ts | 13 +- packages/core.gbapp/models/GBError.ts | 50 ++ packages/core.gbapp/models/GBModel.ts | 19 +- packages/core.gbapp/services/GBAPIService.ts | 20 +- .../core.gbapp/services/GBConfigService.ts | 28 +- .../services/GBConversationalService.ts | 2 +- packages/core.gbapp/services/GBDeployer.ts | 88 +-- .../core.gbapp/services/GBImporterService.ts | 27 +- packages/core.gbapp/services/GBMinService.ts | 68 +- packages/core.gbapp/services/GBVMService.ts | 37 +- packages/core.gbapp/services/TSCompiler.ts | 9 +- packages/core.gbapp/tests/core.test.ts | 8 +- packages/core.gbapp/tests/vm.test.ts | 6 +- .../dialogs/FeedbackDialog.ts | 31 +- .../dialogs/QualityDialog.ts | 12 +- packages/customer-satisfaction.gbapp/index.ts | 11 +- .../models/index.ts | 23 +- .../services/CSService.ts | 5 +- .../default.gbui/public/css/pragmatismo.css | 4 +- packages/default.gbui/public/index.html | 4 +- packages/default.gbui/src/GBUIApp.js | 4 +- .../default.gbui/src/components/ChatPane.js | 4 +- .../default.gbui/src/components/Footer.js | 4 +- packages/default.gbui/src/components/GBCss.js | 4 +- .../default.gbui/src/components/NavBar.js | 4 +- .../src/components/SidebarMenu.js | 4 +- packages/default.gbui/src/index.js | 4 +- .../src/players/GBBulletPlayer.js | 4 +- .../default.gbui/src/players/GBImagePlayer.js | 4 +- .../default.gbui/src/players/GBLoginPlayer.js | 4 +- .../src/players/GBMarkdownPlayer.js | 4 +- .../src/players/GBPowerBIPlayer.js | 4 +- .../default.gbui/src/players/GBVideoPlayer.js | 4 +- packages/kb.gbapp/dialogs/AskDialog.ts | 250 ++++--- packages/kb.gbapp/dialogs/FaqDialog.ts | 12 +- packages/kb.gbapp/dialogs/MenuDialog.ts | 91 ++- packages/kb.gbapp/index.ts | 15 +- packages/kb.gbapp/models/index.ts | 12 +- packages/kb.gbapp/services/KBService.ts | 17 +- packages/security.gblib/index.ts | 9 +- packages/security.gblib/models/index.ts | 11 +- .../security.gblib/services/SecService.ts | 17 +- packages/whatsapp.gblib/index.ts | 34 +- .../services/WhatsappDirectLine.ts | 32 +- src/app.ts | 16 +- tslint.json | 10 +- 62 files changed, 1174 insertions(+), 739 deletions(-) create mode 100644 packages/core.gbapp/models/GBError.ts diff --git a/package-lock.json b/package-lock.json index 7d26985e..16825fcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,19 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@azure/ms-rest-js": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-1.2.6.tgz", + "integrity": "sha512-8cmDpxsQjVdveJwYKtNnkJorxEORLYJu9UHaUvLZA6yHExzDeISHAcSVWE0J05+VkJtqheVHF17M+2ro18Cdnw==", + "requires": { + "axios": "^0.18.0", + "form-data": "^2.3.2", + "tough-cookie": "^2.4.3", + "tslib": "^1.9.2", + "uuid": "^3.2.1", + "xml2js": "^0.4.19" + } + }, "@babel/code-frame": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", @@ -986,6 +999,23 @@ "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": "1.5.2", + "resolved": "https://registry.npmjs.org/@microsoft/microsoft-graph-client/-/microsoft-graph-client-1.5.2.tgz", + "integrity": "sha512-lUsFLQMmi94r5+Eabmi5FBvlmxsqHPzdqm4suegFmcmnOI5+4OCLADORkRFRJXcWzTKB2ypR9x/mGv7f3r9DzA==", + "requires": { + "es6-promise": "^4.2.6", + "isomorphic-fetch": "^2.2.1", + "tslib": "^1.9.3" + }, + "dependencies": { + "es6-promise": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", + "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==" + } + } + }, "@microsoft/recognizers-text": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text/-/recognizers-text-1.1.4.tgz", @@ -1662,6 +1692,18 @@ "@types/request": "*" } }, + "@types/sequelize": { + "version": "4.27.39", + "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.39.tgz", + "integrity": "sha512-FABh5gLbXgh6/0pmJQ7VzjN5KAxd/IbX3G5Z6fSBZ6DSqaYl7DBP22nGtLh2e6dPmC0rUxfJclNhzQcC3XgvVw==", + "dev": true, + "requires": { + "@types/bluebird": "*", + "@types/continuation-local-storage": "*", + "@types/lodash": "*", + "@types/validator": "*" + } + }, "@types/shelljs": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.2.tgz", @@ -2004,6 +2046,11 @@ "readable-stream": "^2.0.6" } }, + "arg": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.0.tgz", + "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==" + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2184,11 +2231,11 @@ "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=" }, "auto-parse": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/auto-parse/-/auto-parse-1.5.1.tgz", - "integrity": "sha1-Oszj3pRKL7Xa433MW1s5yHLYeFI=", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/auto-parse/-/auto-parse-1.6.0.tgz", + "integrity": "sha512-bxQzTBuQxezN8G4d2kd8U7ozJ1vUlEFwa7RVbBIL7IH8nxWikCup/JcdMadEFwnHRUFuJrlYo7i0domuFSXp4w==", "requires": { - "typpy": "^2.3.10" + "typpy": "2.3.10" } }, "aws-sign2": { @@ -2256,9 +2303,9 @@ } }, "azure-cognitiveservices-luis-runtime": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/azure-cognitiveservices-luis-runtime/-/azure-cognitiveservices-luis-runtime-1.2.2.tgz", - "integrity": "sha512-qds2UQ85IWMj9w3HXB0BS0MqSyQ50YlVtS6Y1X6aSf2sN1RVvdct6gZnUMREgjDTKgo+/Iwh4MmPVmhvpPUu0A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/azure-cognitiveservices-luis-runtime/-/azure-cognitiveservices-luis-runtime-1.2.0.tgz", + "integrity": "sha512-8A71ZfDs5uB+t7SX7GdESuAxgAOR+jKmhnRprx09Pk5gfdJd1HSC2moLxUhqJsS1WQ6I+g7ShG7kLXWmQIXQyg==", "requires": { "ms-rest": "^2.5.0" }, @@ -2614,9 +2661,9 @@ }, "dependencies": { "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + "version": "9.6.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", + "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" } } }, @@ -2640,22 +2687,28 @@ }, "dependencies": { "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + "version": "9.6.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", + "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" }, "botbuilder": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", - "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", + "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", "requires": { "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", + "@types/node": "^10.12.18", "async-file": "^2.0.2", - "botbuilder-core": "^4.2.1", - "botframework-connector": "^4.2.1", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" + "botbuilder-core": "^4.3.2", + "botframework-connector": "^4.3.2", + "filenamify": "^2.0.0" + }, + "dependencies": { + "@types/node": { + "version": "10.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", + "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" + } } }, "request-promise-native": { @@ -2684,22 +2737,28 @@ }, "dependencies": { "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + "version": "9.6.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", + "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" }, "botbuilder": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.2.1.tgz", - "integrity": "sha512-58664aLhN1WQwAxMBK7LZQhFh8DHwenvpgz6ADFgeZLZS28NACfX+Uta8k2+WF6RK3g+VKoGOhV/yI71c5ccVg==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", + "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", "requires": { "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", + "@types/node": "^10.12.18", "async-file": "^2.0.2", - "botbuilder-core": "^4.2.1", - "botframework-connector": "^4.2.1", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" + "botbuilder-core": "^4.3.2", + "botframework-connector": "^4.3.2", + "filenamify": "^2.0.0" + }, + "dependencies": { + "@types/node": { + "version": "10.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", + "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" + } } } } @@ -2849,12 +2908,12 @@ } }, "botbuilder-core": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.2.1.tgz", - "integrity": "sha512-U8n+eY9Cjce0GkMyyE0mv4HBjCjtyuczz6usl9XF2N7nY61jYDah4W5e4zqYdLdlqnBwfxG8ptS9pdnmVsC2ww==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.3.2.tgz", + "integrity": "sha512-iKaSjOffhb4b40B3N/k1vjFq0AD5QBtx9/Tg8GdeXgxWtbY0QXiFekU7pKfPBAOS3MhY8h/u7w8SmOnrENk62w==", "requires": { "assert": "^1.4.1", - "botframework-schema": "^4.2.1" + "botframework-schema": "^4.3.2" } }, "botbuilder-core-extensions": { @@ -2943,9 +3002,9 @@ } }, "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + "version": "9.6.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", + "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" } } }, @@ -3094,18 +3153,17 @@ } }, "botframework-connector": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.2.1.tgz", - "integrity": "sha512-O2RmSG4AFyNc7h9zD2a7kdIBw8jF3Thpl8Pwfs/BpKGhRrCIJAMasV0+UbIV2Iwi2NEl7WzdpXjUsnpmB57XgQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.3.2.tgz", + "integrity": "sha512-nwAAULKFMV2uvXf123R2MRcq3slNMYypBLdoa6KMt6Ri+S2FqVIC4vn+y+pIfFDYbOPOkXErh/JlbunOcfTteA==", "requires": { + "@azure/ms-rest-js": "1.2.6", "@types/jsonwebtoken": "7.2.8", - "@types/node": "^9.3.0", + "@types/node": "^10.12.18", "base64url": "^3.0.0", - "botframework-schema": "^4.2.1", + "botframework-schema": "^4.3.2", "form-data": "^2.3.3", "jsonwebtoken": "8.0.1", - "ms-rest-azure-js": "1.0.176", - "ms-rest-js": "1.0.455", "nock": "^10.0.3", "node-fetch": "^2.2.1", "rsa-pem-from-mod-exp": "^0.8.4" @@ -3120,9 +3178,9 @@ } }, "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" + "version": "10.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", + "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" }, "base64url": { "version": "3.0.1", @@ -3139,19 +3197,6 @@ "mime-types": "^2.1.12" } }, - "ms-rest-js": { - "version": "1.0.455", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.455.tgz", - "integrity": "sha512-RUDnFFNhk4ZdvOACg0yfaxmp5OzNwUcTIwgh/rVBeuNzgA7hOoVh5zFW06XmOtaBHXL2Bu/vWoQtzloEUlv9tw==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } - }, "node-fetch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", @@ -3160,33 +3205,9 @@ } }, "botframework-schema": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.2.1.tgz", - "integrity": "sha512-0aJ5UIjs6dKZYdovnlnoIb7+wBId3cubQzwC0tH6S//JhayqrKqMcD8vPPgwZHhBhBx8ZFNmKD3MJtCvZZ1GYA==", - "requires": { - "@types/node": "^9.3.0", - "ms-rest-js": "1.0.455" - }, - "dependencies": { - "@types/node": { - "version": "9.6.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.42.tgz", - "integrity": "sha512-SpeVQJFekfnEaZZO1yl4je/36upII36L7gOT4DBx51B1GeAB45mmDb3a5OBQB+ZeFxVVOP37r8Owsl940G/fBg==" - }, - "ms-rest-js": { - "version": "1.0.455", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.455.tgz", - "integrity": "sha512-RUDnFFNhk4ZdvOACg0yfaxmp5OzNwUcTIwgh/rVBeuNzgA7hOoVh5zFW06XmOtaBHXL2Bu/vWoQtzloEUlv9tw==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } - } - } + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.3.2.tgz", + "integrity": "sha512-++y/EOu52rRz+TWNkFbOu3Dj7fVyXRlrJktMFo6npr2ISnNNntWY5U0U3ouAUDt7aDKRsB1Rcn2LISdS5FRCoA==" }, "botlib": { "version": "0.1.21", @@ -3212,6 +3233,170 @@ "winston": "3.2.1" }, "dependencies": { + "@microsoft/recognizers-text-choice": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-choice/-/recognizers-text-choice-1.1.2.tgz", + "integrity": "sha512-4hFdqxusM0YrOXYM2RVYPl2rLjItSh6VkRiACjWB95GKC/DBGjJRYQpTxhzuZAsJSkDMinu/aLf8DvQtwUaLtA==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "grapheme-splitter": "^1.0.2" + } + }, + "@microsoft/recognizers-text-number": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.2.tgz", + "integrity": "sha512-GESjSF42dllym83diyd6pmlzFwdzidewoq/qSQz89lSoTx9HdJQHjbXxwdBp7w4Ax/Jroo2lcAedM3B7alZhYQ==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "bignumber.js": "^7.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.sortby": "^4.7.0", + "lodash.trimend": "^4.5.1" + } + }, + "@microsoft/recognizers-text-suite": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-suite/-/recognizers-text-suite-1.1.2.tgz", + "integrity": "sha512-w3WCsKa//64jE1fGPFlV02rRg9+b3oDp+K5/skPAn4KDr80LjXxD1ulIgiJ2Ll/2OoBl8ociCiCjYA7zS3LpdQ==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "@microsoft/recognizers-text-choice": "~1.1.2", + "@microsoft/recognizers-text-date-time": "~1.1.2", + "@microsoft/recognizers-text-number": "~1.1.2", + "@microsoft/recognizers-text-number-with-unit": "~1.1.2", + "@microsoft/recognizers-text-sequence": "~1.1.2" + } + }, + "@types/node": { + "version": "9.6.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", + "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" + }, + "botbuilder": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", + "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^9.3.0", + "async-file": "^2.0.2", + "botbuilder-core": "^4.1.7", + "botframework-connector": "^4.1.7", + "filenamify": "^2.0.0", + "rimraf": "^2.6.2" + } + }, + "botbuilder-ai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", + "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", + "requires": { + "@microsoft/recognizers-text-date-time": "1.1.2", + "@types/html-entities": "^1.2.16", + "@types/node": "^9.3.0", + "@types/request-promise-native": "^1.0.10", + "azure-cognitiveservices-luis-runtime": "^1.0.0", + "botbuilder": "^4.2.0", + "html-entities": "^1.2.1", + "moment": "^2.20.1", + "ms-rest": "^2.3.6", + "mstranslator": "^3.0.0", + "request": "^2.87.0", + "request-promise-native": "1.0.5" + }, + "dependencies": { + "botbuilder": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", + "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^10.12.18", + "async-file": "^2.0.2", + "botbuilder-core": "^4.3.2", + "botframework-connector": "^4.3.2", + "filenamify": "^2.0.0" + }, + "dependencies": { + "@types/node": { + "version": "10.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", + "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" + } + } + } + } + }, + "botbuilder-azure": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", + "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", + "requires": { + "@types/node": "^9.3.0", + "azure-storage": "^2.10.2", + "botbuilder": "^4.2.0", + "documentdb": "1.14.5", + "flat": "^4.0.0", + "semaphore": "^1.1.0" + }, + "dependencies": { + "botbuilder": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", + "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^10.12.18", + "async-file": "^2.0.2", + "botbuilder-core": "^4.3.2", + "botframework-connector": "^4.3.2", + "filenamify": "^2.0.0" + }, + "dependencies": { + "@types/node": { + "version": "10.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", + "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" + } + } + } + } + }, + "botbuilder-dialogs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", + "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", + "requires": { + "@microsoft/recognizers-text-choice": "1.1.2", + "@microsoft/recognizers-text-date-time": "1.1.2", + "@microsoft/recognizers-text-number": "1.1.2", + "@microsoft/recognizers-text-suite": "1.1.2", + "@types/node": "^9.3.0", + "botbuilder-core": "^4.2.0" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "dotenv-extended": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/dotenv-extended/-/dotenv-extended-2.3.0.tgz", + "integrity": "sha512-QrFPzMr25tkdEesy2vJQDk0Yqs1Wy0IWSngaU/QNnQfukG735kXp3K+YfW6CMcR/N/3BGw5oIqyBLtGU8a5SZQ==", + "requires": { + "@types/dotenv": "^4.0.0", + "auto-parse": "^1.3.0", + "camelcase": "5.0.0", + "cross-spawn": "6.0.5", + "dotenv": "6.0.0", + "is-windows": "^1.0.0", + "lodash": "^4.17.10" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3219,6 +3404,45 @@ "requires": { "safer-buffer": ">= 2.1.2 < 3" } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" + } + }, + "sequelize": { + "version": "4.42.1", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.42.1.tgz", + "integrity": "sha512-W9i/CkBjCHLzEkJQkaxXaK82MA16b7F74PjtE7EUR+d7WU/X3U+YU5givWR+/VRXay1VXDyBOfXgw9/zdhDSDg==", + "requires": { + "bluebird": "^3.5.0", + "cls-bluebird": "^2.1.0", + "debug": "^3.1.0", + "depd": "^1.1.0", + "dottie": "^2.0.0", + "generic-pool": "3.5.0", + "inflection": "1.12.0", + "lodash": "^4.17.1", + "moment": "^2.20.0", + "moment-timezone": "^0.5.14", + "retry-as-promised": "^2.3.2", + "semver": "^5.5.0", + "terraformer-wkt-parser": "^1.1.2", + "toposort-class": "^1.0.1", + "uuid": "^3.2.1", + "validator": "^10.4.0", + "wkx": "^0.4.1" + } + }, + "validator": { + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", + "integrity": "sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==" } } }, @@ -3802,6 +4026,11 @@ "restore-cursor": "^2.0.0" } }, + "cli-spinner": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/cli-spinner/-/cli-spinner-0.2.10.tgz", + "integrity": "sha512-U0sSQ+JJvSLi1pAYuJykwiA8Dsr15uHEy85iCJ6A+0DjVxivr3d+N2Wjvodeg89uP5K6TswFkKBfAD7B3YSn/Q==" + }, "cli-table": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", @@ -4076,6 +4305,11 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" + }, "commitizen": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-3.0.7.tgz", @@ -4262,6 +4496,15 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "configstore": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", @@ -5253,12 +5496,12 @@ "dotenv": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.0.0.tgz", - "integrity": "sha1-JON8BBdBxfSyUySVjrvDS8qWWTU=" + "integrity": "sha512-FlWbnhgjtwD+uNLUGHbMykMOYQaTivdHEmYwAKFjn6GKe/CqY0fNae93ZHTd20snh9ZLr8mTzIL9m0APQ1pjQg==" }, "dotenv-extended": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/dotenv-extended/-/dotenv-extended-2.3.0.tgz", - "integrity": "sha1-fCWVHKt+Ib0XFbhxG0GD308tx6M=", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/dotenv-extended/-/dotenv-extended-2.4.0.tgz", + "integrity": "sha512-OJmXoMk3YpxsGAibLUi4F8Uu2CN9wtDO/Uqv9kWx1bL6qXcku1jq+hk5wTaX7UVcpcl5rCbUrvN9nv0bOXC/Kw==", "requires": { "@types/dotenv": "^4.0.0", "auto-parse": "^1.3.0", @@ -5311,6 +5554,38 @@ "safe-buffer": "^5.0.1" } }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + } + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -8205,6 +8480,15 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, + "isomorphic-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "requires": { + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" + } + }, "isomorphic-form-data": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-0.0.1.tgz", @@ -8274,6 +8558,33 @@ "integrity": "sha512-CpKJh9VRNhS+XqZtg1UMejETGEiqwCGDC/uwPEEQwc2nfdbSm73SIE29TplG2gLYuBOOTNDqxzG6A9NtEPLt0w==", "dev": true }, + "js-beautify": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.9.0.tgz", + "integrity": "sha512-P0skmY4IDjfLiVrx+GLDeme8w5G0R1IGXgccVU5HP2VM3lRblH7qN2LTea5vZAxrDjpZBD0Jv+ahpjwVcbz/rw==", + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.2", + "glob": "^7.1.3", + "mkdirp": "~0.5.0", + "nopt": "~4.0.1" + }, + "dependencies": { + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -8898,6 +9209,11 @@ "pify": "^3.0.0" } }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==" + }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -9474,30 +9790,6 @@ } } }, - "ms-rest-azure-js": { - "version": "1.0.176", - "resolved": "https://registry.npmjs.org/ms-rest-azure-js/-/ms-rest-azure-js-1.0.176.tgz", - "integrity": "sha512-qtEBpSf/1nJ0/m1jGLkHISRnpOeHUp5n4SvzZRdFeYnGF4SQx9v/fl8a8ZwEmyujmgbUwyLNM9qKpH5PmW7pZg==", - "requires": { - "ms-rest-js": "^1.0.443", - "tslib": "^1.9.2" - }, - "dependencies": { - "ms-rest-js": { - "version": "1.0.465", - "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.465.tgz", - "integrity": "sha512-MMSmxy6yd/EcxcKxdKy13SckcjBWSgcFkO2Ggibw0wQvZKr3DDaOGOaivElfdRkA+djacZLl4A912MNT5VhBPA==", - "requires": { - "axios": "^0.18.0", - "form-data": "^2.3.2", - "tough-cookie": "^2.4.3", - "tslib": "^1.9.2", - "uuid": "^3.2.1", - "xml2js": "^0.4.19" - } - } - } - }, "ms-rest-js": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.1.tgz", @@ -14740,6 +15032,11 @@ "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=" }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, "protocols": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.6.tgz", @@ -15937,9 +16234,9 @@ } }, "sequelize": { - "version": "4.42.1", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.42.1.tgz", - "integrity": "sha512-W9i/CkBjCHLzEkJQkaxXaK82MA16b7F74PjtE7EUR+d7WU/X3U+YU5givWR+/VRXay1VXDyBOfXgw9/zdhDSDg==", + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.43.0.tgz", + "integrity": "sha512-GkwGFVREKBf/ql6W6RXwXy1fzb/HOk0lmOBbcQrJMvJtB65Jfg7CUh+sENh0deuWk5s79JedgZJ/yEjvtzHXaQ==", "requires": { "bluebird": "^3.5.0", "cls-bluebird": "^2.1.0", @@ -16092,6 +16389,11 @@ } } }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -16433,7 +16735,6 @@ "version": "0.5.10", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", - "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -16442,8 +16743,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" } } }, @@ -17520,11 +17820,73 @@ "semver": "^5.0.1" } }, + "ts-node": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.0.3.tgz", + "integrity": "sha512-2qayBA4vdtVRuDo11DEFSsD/SFsBXQBRZZhbRGSIkmYmVkWjULn/GGMdG10KVqkaGndljfaTD8dKjWgcejO8YA==", + "requires": { + "arg": "^4.1.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "^3.0.0" + } + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=" }, + "tslint": { + "version": "5.13.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.1.tgz", + "integrity": "sha512-fplQqb2miLbcPhyHoMV4FU9PtNRbgmm/zI5d3SZwwmJQM6V0eodju+hplpyfhLWpmwrDNfNYU57uYRb8s0zZoQ==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.27.2" + } + }, + "tslint-microsoft-contrib": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/tslint-microsoft-contrib/-/tslint-microsoft-contrib-6.1.0.tgz", + "integrity": "sha512-8DgmiPTgNQSYTjrKKv/h1aHnDd7EkGAjTxatrjfSDp5jUXENGI7Qj7qi7T8xBdTZN9Z3nb80u0NhdBBOMcQFHg==", + "dev": true, + "requires": { + "tsutils": "^2.27.2 <2.29.0" + }, + "dependencies": { + "tsutils": { + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.28.0.tgz", + "integrity": "sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tunnel": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", @@ -18059,6 +18421,11 @@ } } }, + "whatwg-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + }, "whatwg-mimetype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", @@ -18577,6 +18944,11 @@ } } } + }, + "yn": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.0.0.tgz", + "integrity": "sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q==" } } } diff --git a/package.json b/package.json index 8c5c757e..d9123a41 100644 --- a/package.json +++ b/package.json @@ -59,11 +59,11 @@ "azure-arm-website": "5.7.0", "bluebird": "^3.5.3", "body-parser": "1.18.3", - "botbuilder": "4.3.2", - "botbuilder-ai": "4.3.2", - "botbuilder-azure": "4.3.2", + "botbuilder": "4.1.7", + "botbuilder-ai": "4.2.0", + "botbuilder-azure": "4.2.0", "botbuilder-choices": "4.0.0-preview1.2", - "botbuilder-dialogs": "4.3.2", + "botbuilder-dialogs": "4.2.0", "botbuilder-prompts": "4.0.0-preview1.2", "botlib": "^0.1.21", "chai": "4.2.0", diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index d385f175..eb27b4d4 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -38,7 +38,7 @@ import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBDialog } from 'botlib'; -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBConfigService } from '../../core.gbapp/services/GBConfigService'; import { GBDeployer } from '../../core.gbapp/services/GBDeployer'; @@ -53,7 +53,7 @@ export class AdminDialog extends IGBDialog { const packageName = text.split(' ')[1]; const importer = new GBImporter(min.core); const deployer = new GBDeployer(min.core, importer); - await deployer.undeployPackageFromLocalPath(min.instance, UrlJoin('packages', packageName)); + await deployer.undeployPackageFromLocalPath(min.instance, urlJoin('packages', packageName)); } public static isSharePointPath(path: string) { @@ -63,14 +63,12 @@ export class AdminDialog extends IGBDialog { public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: GBDeployer) { const packageName = text.split(' ')[1]; - if (AdminDialog.isSharePointPath(packageName)) { - await deployer.deployFromSharePoint(min.instance.instanceId, packageName); - } else { + if (!AdminDialog.isSharePointPath(packageName)) { const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); if (additionalPath !== undefined) { throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.'); } - await deployer.deployPackageFromLocalPath(min, UrlJoin(additionalPath, packageName)); + await deployer.deployPackage(min, urlJoin(additionalPath, packageName)); } } @@ -207,7 +205,7 @@ export class AdminDialog extends IGBDialog { const url = `https://login.microsoftonline.com/${ min.instance.authenticatorTenant - }/oauth2/authorize?client_id=${min.instance.authenticatorClientId}&response_type=code&redirect_uri=${UrlJoin( + }/oauth2/authorize?client_id=${min.instance.authenticatorClientId}&response_type=code&redirect_uri=${urlJoin( min.instance.botEndpoint, min.instance.botId, '/token' diff --git a/packages/admin.gbapp/index.ts b/packages/admin.gbapp/index.ts index cfd99bed..a23622a9 100644 --- a/packages/admin.gbapp/index.ts +++ b/packages/admin.gbapp/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,18 +36,29 @@ 'use strict'; -import { GBMinInstance, IGBCoreService, IGBPackage, GBDialogStep } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { AdminDialog } from './dialogs/AdminDialog'; import { GuaribasAdmin } from './models/AdminModel'; +/** + * The package for admin.gbapp. + */ export class GBAdminPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; - public unloadPackage(core: IGBCoreService): void {} - public getDialogs(min: GBMinInstance) {} - public unloadBot(min: GBMinInstance): void {} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasAdmin]); diff --git a/packages/admin.gbapp/models/AdminModel.ts b/packages/admin.gbapp/models/AdminModel.ts index 99cd37c4..bac6116b 100644 --- a/packages/admin.gbapp/models/AdminModel.ts +++ b/packages/admin.gbapp/models/AdminModel.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -45,6 +45,9 @@ import { UpdatedAt } from 'sequelize-typescript'; +/** + * General settings store. + */ @Table export class GuaribasAdmin extends Model { diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index f844a299..a3a481d1 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -37,8 +37,8 @@ 'use strict'; import { AuthenticationContext, TokenResponse } from 'adal-node'; -import { IGBAdminService, IGBCoreService } from 'botlib'; -import UrlJoin = require('url-join'); +import { IGBAdminService, IGBCoreService, IGBInstance } from 'botlib'; +import urlJoin = require('url-join'); import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; import { GuaribasAdmin } from '../models/AdminModel'; const msRestAzure = require('ms-rest-azure'); @@ -70,7 +70,6 @@ export class GBAdminService implements IGBAdminService { } public static async getADALCredentialsFromUsername(username: string, password: string) { - return await msRestAzure.loginWithUsernamePassword(username, password); } @@ -101,7 +100,7 @@ export class GBAdminService implements IGBAdminService { maximumLength: 14 }; - return passwordGenerator.generatePassword(options); + return passwordGenerator.generatePassword(options); } public async setValue(instanceId: number, key: string, value: string) { @@ -123,7 +122,7 @@ export class GBAdminService implements IGBAdminService { authenticatorAuthorityHostUrl: string, authenticatorClientId: string, authenticatorClientSecret: string - ): Promise { + ): Promise { const options = { where: {} }; options.where = { instanceId: instanceId }; const item = await GuaribasInstance.findOne(options); @@ -135,7 +134,7 @@ export class GBAdminService implements IGBAdminService { return item.save(); } - public async getValue(instanceId: number, key: string) { + public async getValue(instanceId: number, key: string): Promise { const options = { where: {} }; options.where = { key: key, instanceId: instanceId }; const obj = await GuaribasAdmin.findOne(options); @@ -152,7 +151,7 @@ export class GBAdminService implements IGBAdminService { const accessToken = await this.getValue(instanceId, 'accessToken'); resolve(accessToken); } else { - const authorizationUrl = UrlJoin( + const authorizationUrl = urlJoin( instance.authenticatorAuthorityHostUrl, instance.authenticatorTenant, '/oauth2/authorize' diff --git a/packages/admin.gbapp/strings.ts b/packages/admin.gbapp/strings.ts index 0775e9ed..30beca96 100644 --- a/packages/admin.gbapp/strings.ts +++ b/packages/admin.gbapp/strings.ts @@ -16,7 +16,8 @@ export const Messages = { wrong_password: 'Sorry, wrong password. Please, try again.', enter_authenticator_tenant: 'Enter the Authenticator Tenant (eg.: domain.onmicrosoft.com):', enter_authenticator_authority_host_url: 'Enter the Authority Host URL (eg.: https://login.microsoftonline.com): ', - enter_authenticator_client_id: 'Enter the Client Id [Application Id](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview) GUID:', + enter_authenticator_client_id: `Enter the Client Id GUID: Get from + [this url](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview)`, enter_authenticator_client_secret: 'Enter the Client Secret:' }, 'pt-BR': { diff --git a/packages/analytics.gblib/index.ts b/packages/analytics.gblib/index.ts index 91e07bed..6e123cb4 100644 --- a/packages/analytics.gblib/index.ts +++ b/packages/analytics.gblib/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,14 +36,14 @@ 'use strict'; -import { GBDialogStep, GBMinInstance, IGBCoreService, IGBPackage, GBLog } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; /** * .gblib Package handler. */ export class GBAnalyticsPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); } diff --git a/packages/analytics.gblib/models/index.ts b/packages/analytics.gblib/models/index.ts index 63b148b3..34d4a4c7 100644 --- a/packages/analytics.gblib/models/index.ts +++ b/packages/analytics.gblib/models/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -65,6 +65,56 @@ import { GuaribasChannel, GuaribasInstance } from '../../core.gbapp/models/GBMod import { GuaribasSubject } from '../../kb.gbapp/models'; import { GuaribasUser } from '../../security.gblib/models'; +/** + * A single message in a conversation. + */ +@Table +export class GuaribasConversationMessage extends Model { + + @PrimaryKey + @AutoIncrement + @Column + public conversationMessageId: number; + + @ForeignKey(() => GuaribasSubject) + @Column + public subjectId: number; + + @Column(DataType.TEXT) + public content: string; + + @Column + @CreatedAt + public createdAt: Date; + + @Column + @UpdatedAt + public updatedAt: Date; + + //tslint:disable-next-line:no-use-before-declare + @ForeignKey(() => GuaribasConversation) + @Column + public conversationId: number; + + //tslint:disable-next-line:no-use-before-declare + @BelongsTo(() => GuaribasConversation) + public conversation: GuaribasConversation; + + @ForeignKey(() => GuaribasInstance) + @Column + public instanceId: number; + + @ForeignKey(() => GuaribasUser) + @Column + public userId: number; + + @BelongsTo(() => GuaribasUser) + public user: GuaribasUser; +} + +/** + * A conversation that groups many messages. + */ @Table export class GuaribasConversation extends Model { @@ -106,45 +156,3 @@ export class GuaribasConversation extends Model { @BelongsTo(() => GuaribasUser) public startedBy: GuaribasUser; } - -@Table -export class GuaribasConversationMessage extends Model { - - @PrimaryKey - @AutoIncrement - @Column - public conversationMessageId: number; - - @ForeignKey(() => GuaribasSubject) - @Column - public subjectId: number; - - @Column(DataType.TEXT) - public content: string; - - @Column - @CreatedAt - public createdAt: Date; - - @Column - @UpdatedAt - public updatedAt: Date; - - @ForeignKey(() => GuaribasConversation) - @Column - public conversationId: number; - - @BelongsTo(() => GuaribasConversation) - public conversation: GuaribasConversation; - - @ForeignKey(() => GuaribasInstance) - @Column - public instanceId: number; - - @ForeignKey(() => GuaribasUser) - @Column - public userId: number; - - @BelongsTo(() => GuaribasUser) - public user: GuaribasUser; -} diff --git a/packages/analytics.gblib/services/AnalyticsService.ts b/packages/analytics.gblib/services/AnalyticsService.ts index abefd2bc..2a12eccf 100644 --- a/packages/analytics.gblib/services/AnalyticsService.ts +++ b/packages/analytics.gblib/services/AnalyticsService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -37,6 +37,9 @@ import { GuaribasUser } from '../../security.gblib/models'; import { GuaribasConversation, GuaribasConversationMessage } from '../models'; +/** + * Base services for Bot Analytics. + */ export class AnalyticsService { public async createConversation( user: GuaribasUser @@ -52,7 +55,7 @@ export class AnalyticsService { }); } - public createMessage( + public async createMessage( conversation: GuaribasConversation, user: GuaribasUser, content: string diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index dbfe0b18..8912dabf 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | diff --git a/packages/azuredeployer.gbapp/index.ts b/packages/azuredeployer.gbapp/index.ts index 13563ab1..4ddaff36 100644 --- a/packages/azuredeployer.gbapp/index.ts +++ b/packages/azuredeployer.gbapp/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,11 +36,14 @@ 'use strict'; -import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; +/** + * Package for Azure Deployer. + */ export class GBAzureDeployerPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 735b3c27..d59c2bf6 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -54,7 +54,7 @@ const Spinner = require('cli-spinner').Spinner; // tslint:disable-next-line:no-submodule-imports import { CognitiveServicesAccount } from 'azure-arm-cognitiveservices/lib/models'; -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); const iconUrl = 'https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-logo-squared.png'; const publicIp = require('public-ip'); @@ -89,7 +89,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { req.headers = {}; req.headers['Content-Type'] = 'application/json'; req.headers['accept-language'] = '*'; - req.headers['Authorization'] = `Bearer ${accessToken}`; + req.headers.set(' Authorization', `Bearer ${accessToken}`); req.body = body; return req; @@ -220,10 +220,11 @@ export class AzureDeployerService implements IGBInstallationDeployer { const query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ this.provider }/botServices/${botId}?api-version=${this.apiVersion}`; - const url = UrlJoin(baseUrl, query); + const url = urlJoin(baseUrl, query); const req = AzureDeployerService.createRequestObject(url, accessToken, 'PATCH', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); - if (!(res['bodyAsJson'] as any).id) { + // CHECK + if (!JSON.parse(res.bodyAsText).id) { throw res.bodyAsText; } GBLog.info(`Bot proxy updated at: ${endpoint}.`); @@ -399,7 +400,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { private async registerProviders(subscriptionId, baseUrl, accessToken) { const query = `subscriptions/${subscriptionId}/providers/${this.provider}/register?api-version=2018-02-01`; - const requestUrl = UrlJoin(baseUrl, query); + const requestUrl = urlJoin(baseUrl, query); const req = new WebResource(); req.method = 'POST'; @@ -407,7 +408,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { req.headers = {}; req.headers['Content-Type'] = 'application/json; charset=utf-8'; req.headers['accept-language'] = '*'; - req.headers['Authorization'] = `Bearer ${accessToken}`; + req.headers.set('Authorization', `Bearer ${accessToken}`); } /** @@ -461,10 +462,10 @@ export class AzureDeployerService implements IGBInstallationDeployer { let query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ this.provider }/botServices/${botId}?api-version=${this.apiVersion}`; - let url = UrlJoin(baseUrl, query); + let url = urlJoin(baseUrl, query); let req = AzureDeployerService.createRequestObject(url, accessToken, 'PUT', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); - if (!(res['bodyAsJson'] as any).id) { + if (!JSON.parse(res.bodyAsText).id) { reject(res.bodyAsText); return; @@ -476,10 +477,10 @@ export class AzureDeployerService implements IGBInstallationDeployer { query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/Microsoft.BotService/botServices/${botId}/channels/WebChatChannel/listChannelWithKeys?api-version=${ this.apiVersion }`; - url = UrlJoin(baseUrl, query); + url = urlJoin(baseUrl, query); req = AzureDeployerService.createRequestObject(url, accessToken, 'GET', JSON.stringify(parameters)); const resChannel = await httpClient.sendRequest(req); - const key = (resChannel['bodyAsJson'] as any).properties.properties.sites[0].key; + const key = JSON.parse(resChannel.bodyAsText).properties.properties.sites[0].key; instance.webchatKey = key; resolve(instance); } catch (error) { @@ -504,7 +505,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const body = JSON.stringify(parameters); const apps = await this.makeNlpRequest(location, authoringKey, undefined, 'GET', 'apps'); - const app = (apps['bodyAsJson'] as any).filter(x => x.name === name)[0]; + const app = JSON.parse(apps.bodyAsText).filter(x => x.name === name)[0]; let id: string; if (!app) { const res = await this.makeNlpRequest(location, authoringKey, body, 'POST', 'apps'); @@ -526,7 +527,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const req = new WebResource(); req.method = method; req.url = `https://${location}.api.cognitive.microsoft.com/luis/api/v2.0/${resource}`; - req.headers = {}; + req.headers = {}; req.headers['Content-Type'] = 'application/json'; req.headers['accept-language'] = '*'; req.headers['Ocp-Apim-Subscription-Key'] = authoringKey; diff --git a/packages/console.gblib/index.ts b/packages/console.gblib/index.ts index b76df96d..338cf243 100644 --- a/packages/console.gblib/index.ts +++ b/packages/console.gblib/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,15 +36,15 @@ 'use strict'; -import UrlJoin = require('url-join'); - -import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; - +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { ConsoleDirectLine } from './services/ConsoleDirectLine'; +/** + * Package for console.glib. + */ export class GBConsolePackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public channel: ConsoleDirectLine; public getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); diff --git a/packages/core.gbapp/dialogs/WelcomeDialog.ts b/packages/core.gbapp/dialogs/WelcomeDialog.ts index ced210bb..cfc026f7 100644 --- a/packages/core.gbapp/dialogs/WelcomeDialog.ts +++ b/packages/core.gbapp/dialogs/WelcomeDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -38,10 +38,12 @@ import { BotAdapter } from 'botbuilder'; import {WaterfallDialog } from 'botbuilder-dialogs'; -import { IGBDialog } from 'botlib'; -import { GBMinInstance } from 'botlib'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { Messages } from '../strings'; +/** + * Dialog for Welcoming people. + */ export class WelcomeDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -73,9 +75,9 @@ export class WelcomeDialog extends IGBDialog { await step.replaceDialog('/ask', { firstTime: true }); if ( - step.context.activity && - step.context.activity.type == 'message' && - step.context.activity.text != '' + step.context.activity !== undefined && + step.context.activity.type === 'message' && + step.context.activity.text !== '' ) { await step.replaceDialog('/answer', { query: step.context.activity.text }); } diff --git a/packages/core.gbapp/dialogs/WhoAmIDialog.ts b/packages/core.gbapp/dialogs/WhoAmIDialog.ts index 20d7162e..201334cb 100644 --- a/packages/core.gbapp/dialogs/WhoAmIDialog.ts +++ b/packages/core.gbapp/dialogs/WhoAmIDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -38,10 +38,11 @@ import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { IGBDialog } from 'botlib'; -import { GBMinInstance } from 'botlib'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { Messages } from '../strings'; - +/** + * Dialog for the bot explains about itself. + */ export class WhoAmIDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -55,7 +56,7 @@ export class WhoAmIDialog extends IGBDialog { const locale = step.context.activity.locale; await step.context.sendActivity(`${min.instance.description}`); - if (min.instance.whoAmIVideo) { + if (min.instance.whoAmIVideo !== undefined) { await step.context.sendActivity(Messages[locale].show_video); await min.conversationalService.sendEvent(step, 'play', { playerType: 'video', diff --git a/packages/core.gbapp/index.ts b/packages/core.gbapp/index.ts index 94f227cb..1fcf4e03 100644 --- a/packages/core.gbapp/index.ts +++ b/packages/core.gbapp/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,19 +36,18 @@ 'use strict'; -import UrlJoin = require('url-join'); - -import { GBMinInstance, IGBPackage, GBLog, GBDialogStep } from 'botlib'; - -import { IGBCoreService } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { WelcomeDialog } from './dialogs/WelcomeDialog'; import { WhoAmIDialog } from './dialogs/WhoAmIDialog'; import { GuaribasChannel, GuaribasException, GuaribasInstance, GuaribasPackage } from './models/GBModel'; +/** + * Package for core.gbapp. + */ export class GBCorePackage implements IGBPackage { public static CurrentEngineName = 'guaribas-1.0.0'; - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { core.sequelize.addModels([GuaribasInstance, GuaribasPackage, GuaribasChannel, GuaribasException]); } diff --git a/packages/core.gbapp/models/GBError.ts b/packages/core.gbapp/models/GBError.ts new file mode 100644 index 00000000..a0c8366a --- /dev/null +++ b/packages/core.gbapp/models/GBError.ts @@ -0,0 +1,50 @@ +/*****************************************************************************\ +| ( )_ _ | +| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | +| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | +| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | +| | | ( )_) | | +| (_) \___/' | +| | +| General Bots Copyright (c) Pragmatismo.io. All rights reserved. | +| Licensed under the AGPL-3.0. | +| | +| According to our dual licensing model, this program can be used either | +| under the terms of the GNU Affero General Public License, version 3, | +| or under a proprietary license. | +| | +| The texts of the GNU Affero General Public License with an additional | +| permission and of our proprietary license can be found at and | +| in the LICENSE file you have received along with this program. | +| | +| This program is distributed in the hope that it will be useful, | +| but WITHOUT ANY WARRANTY, without even the implied warranty of | +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +| GNU Affero General Public License for more details. | +| | +| "General Bots" is a registered trademark of Pragmatismo.io. | +| The licensing of the program under the AGPLv3 does not imply a | +| trademark license. Therefore any rights, title and interest in | +| our trademarks remain entirely with us. | +| | +\*****************************************************************************/ + +/** + * @fileoverview General Bots server core. + */ + +'use strict'; + +import { + AutoIncrement, + BelongsTo, + Column, + CreatedAt, + ForeignKey, + Model, + PrimaryKey, + Table, + UpdatedAt +} from 'sequelize-typescript'; +import { GuaribasInstance } from './GBModel'; diff --git a/packages/core.gbapp/models/GBModel.ts b/packages/core.gbapp/models/GBModel.ts index cf1dac68..339eb864 100644 --- a/packages/core.gbapp/models/GBModel.ts +++ b/packages/core.gbapp/models/GBModel.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -51,6 +51,9 @@ import { import { IGBInstance } from 'botlib'; +/** + * Base instance data for a bot. + */ @Table export class GuaribasInstance extends Model implements IGBInstance { @@ -81,8 +84,6 @@ export class GuaribasInstance extends Model @Column public enabledAdmin: boolean; - /* Services section on bot.json */ - @Column public engineName: string; @@ -219,8 +220,6 @@ export class GuaribasInstance extends Model @Column public adminPass: string; - /* Settings section of bot.json */ - @Column(DataType.FLOAT) public nlpVsSearch: number; @@ -239,6 +238,9 @@ export class GuaribasInstance extends Model public updatedAt: Date; } +/** + * Each packaged listed for use in a bot instance. + */ @Table export class GuaribasPackage extends Model { @PrimaryKey @@ -265,6 +267,9 @@ export class GuaribasPackage extends Model { public updatedAt: Date; } +/** + * A bot channel. + */ @Table export class GuaribasChannel extends Model { @PrimaryKey @@ -284,7 +289,11 @@ export class GuaribasChannel extends Model { public updatedAt: Date; } +/** + * An exception that has been thrown. + */ @Table +//tslint:disable-next-line:max-classes-per-file export class GuaribasException extends Model { @PrimaryKey @AutoIncrement diff --git a/packages/core.gbapp/services/GBAPIService.ts b/packages/core.gbapp/services/GBAPIService.ts index 03ddc01b..104caf5d 100644 --- a/packages/core.gbapp/services/GBAPIService.ts +++ b/packages/core.gbapp/services/GBAPIService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,11 +36,15 @@ import { TurnContext } from 'botbuilder'; import { WaterfallStepContext } from 'botbuilder-dialogs'; import { GBLog, GBMinInstance } from 'botlib'; import * as request from 'request-promise-native'; -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); import { GBAdminService } from '../../admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; import { GBDeployer } from './GBDeployer'; +/** + * @fileoverview General Bots server core. + */ + /** * BASIC system class for extra manipulation of bot behaviour. */ @@ -100,18 +104,18 @@ class SysClass { public async httpGet(url: string, qs) { const options = { - uri: UrlJoin(url , qs) + uri: urlJoin(url , qs) }; - return await request.get(options); + return request.get(options); } } -/** - * @fileoverview General Bots server core. - */ -export default class DialogClass { +/** + * Base services of conversation to be called by BASIC. + */ +export class DialogClass { public min: GBMinInstance; public context: TurnContext; diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index 0b13d92e..65875d85 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -30,16 +30,30 @@ | | \*****************************************************************************/ -import * as fs from 'fs'; +'use strict'; + import { GBLog } from 'botlib'; /** * @fileoverview General Bots server core. */ -'use strict'; - +/** + * Base configuration for the server like storage. + */ export class GBConfigService { + + public static getServerPort(): number { + if (process.env.port !== undefined) { + return Number(process.env.port); + } + if (process.env.PORT !== undefined) { + return Number(process.env.PORT); + } + + return 4242; + } + public static init(): any { try { require('dotenv-extended').load({ @@ -57,7 +71,7 @@ export class GBConfigService { public static get(key: string): string | undefined { let value = GBConfigService.tryGet(key); - if (!value) { + if (value !== undefined) { switch (key) { case 'CLOUD_USERNAME': value = undefined; @@ -117,8 +131,8 @@ export class GBConfigService { } public static tryGet(key: string) { - let value = process.env['container:' + key]; - if (!value) { + let value = process.env[`container:${key}`]; + if (value !== undefined) { value = process.env[key]; } diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index e5e4c184..68024e3c 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 8d1d70b8..f954e338 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -37,22 +37,19 @@ 'use strict'; const Path = require('path'); -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); const Fs = require('fs'); const WaitUntil = require('wait-until'); const express = require('express'); const child_process = require('child_process'); const graph = require('@microsoft/microsoft-graph-client'); -import { GBMinInstance, IGBCoreService, IGBInstance, GBLog } from 'botlib'; -import { GBError, IGBPackage } from 'botlib'; +import { GBError, GBLog, GBMinInstance, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; import { AzureSearch } from 'pragmatismo-io-framework'; -import { AzureDeployerService } from '../../azuredeployer.gbapp/services/AzureDeployerService'; -import { GuaribasInstance, GuaribasPackage } from '../models/GBModel'; +import { GuaribasPackage } from '../models/GBModel'; import { GBAdminService } from './../../admin.gbapp/services/GBAdminService'; import { KBService } from './../../kb.gbapp/services/KBService'; import { GBConfigService } from './GBConfigService'; -import { GBCoreService } from './GBCoreService'; import { GBImporter } from './GBImporterService'; import { GBVMService } from './GBVMService'; @@ -73,7 +70,7 @@ export class GBDeployer { } public static getConnectionStringFromInstance(instance: IGBInstance) { - return `Server=tcp:${instance.storageServer}.database.windows.net,1433;Database=${instance.storageName};User ID=${ + return `Server=tcp:torageServer}.database.windows.net,1433;Database=${instance.storageName};User ID=${ instance.storageUsername };Password=${instance.storagePassword};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;`; } @@ -91,12 +88,12 @@ export class GBDeployer { let totalPackages = 0; const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); let paths = [GBDeployer.deployFolder]; - if (additionalPath) { + if (additionalPath !== undefined) { paths = paths.concat(additionalPath.toLowerCase().split(';')); } - const botPackages = new Array(); - const gbappPackages = new Array(); - let generalPackages = new Array(); + const botPackages: string[] = undefined; + const gbappPackages: string[] = undefined; + let generalPackages: string[]; function doIt(path) { const isDirectory = source => Fs.lstatSync(source).isDirectory(); @@ -138,7 +135,7 @@ export class GBDeployer { GBLog.info(`Waiting for app package deployment...`); cb(appPackagesProcessed === gbappPackages.length); }) - .done(async result => { + .done(async () => { GBLog.info(`App Package deployment done.`); ({ generalPackages, totalPackages } = await this.deployDataPackages( @@ -161,11 +158,9 @@ export class GBDeployer { */ public async deployBot(localPath: string): Promise { - const packageType = Path.extname(localPath); const packageName = Path.basename(localPath); - const instance = await this.importer.importIfNotExistsBotPackage(null, packageName, localPath); - return instance; + return await this.importer.importIfNotExistsBotPackage(undefined, packageName, localPath); } public async deployPackageToStorage(instanceId: number, packageName: string): Promise { @@ -175,7 +170,7 @@ export class GBDeployer { }); } - public async deployFromSharePoint(instanceId: number, path: string) { + public async deployFromSharePoint(instanceId: number) { const adminService = new GBAdminService(this.core); const accessToken = adminService.acquireElevatedToken(instanceId); @@ -183,59 +178,30 @@ export class GBDeployer { const client = graph.Client.init({ authProvider: done => { - done(null, accessToken); + done(undefined, accessToken); } }); - - const events = await client - .api('/me/events') - .select('subject,organizer,start,end') - .orderby('createdDateTime DESC') - .get(); } - public deployScriptToStorage(instanceId: number, localPath: string) {} - - public deployTheme(localPath: string) { - // DISABLED: Until completed, "/ui/public". - // FsExtra.copy(localPath, this.workDir + packageName) - // .then(() => { - // }) - // .catch(err => { - // var gberr = GBError.create( - // `GuaribasBusinessError: Error copying package: ${localPath}.` - // ) - // }) - } - - public async deployPackageFromSharePoint(min: GBMinInstance, path: string) {} - - public async deployPackageFromLocalPath(min: GBMinInstance, localPath: string) { + public async deployPackage(min: GBMinInstance, localPath: string) { const packageType = Path.extname(localPath); switch (packageType) { case '.gbot': return this.deployBot(localPath); - case '.gbtheme': - return this.deployTheme(localPath); - - // PACKAGE: Put in package logic. case '.gbkb': const service = new KBService(this.core.sequelize); return service.deployKb(this.core, this, localPath); - case '.gbui': - break; - case '.gbdialog': const vm = new GBVMService(); return vm.loadDialogPackage(localPath, min, this.core, this); default: - const err = GBError.create(`GuaribasBusinessError: Unknown package type: ${packageType}.`); + const err = GBError.create(`Unhandled package type: ${packageType}.`); Promise.reject(err); break; } @@ -248,14 +214,6 @@ export class GBDeployer { const p = await this.getPackageByName(instance.instanceId, packageName); switch (packageType) { - case '.gbot': - // TODO: this.undeployBot(packageName, localPath) - break; - - case '.gbtheme': - // TODO: this.undeployTheme(packageName, localPath) - break; - case '.gbkb': const service = new KBService(this.core.sequelize); @@ -268,7 +226,7 @@ export class GBDeployer { break; default: - const err = GBError.create(`GuaribasBusinessError: Unknown package type: ${packageType}.`); + const err = GBError.create(`Unhandled package type: ${packageType}.`); Promise.reject(err); break; } @@ -288,7 +246,7 @@ export class GBDeployer { try { await search.deleteDataSource(dsName); } catch (err) { - if (err.code != 404) { + if (err.code !== 404) { // First time, nothing to delete. throw err; } @@ -299,7 +257,7 @@ export class GBDeployer { try { await search.deleteIndex(); } catch (err) { - if (err.code != 404) { + if (err.code !== 404) { // First time, nothing to delete. throw err; } @@ -363,11 +321,11 @@ export class GBDeployer { if (Path.extname(filename) === '.gbapp' || Path.extname(filename) === '.gblib') { // Themes for bots. } else if (Path.extname(filename) === '.gbtheme') { - server.use('/themes/' + filenameOnly, express.static(filename)); - GBLog.info(`Theme (.gbtheme) assets accessible at: ${'/themes/' + filenameOnly}.`); + server.use(`/themes/${filenameOnly}`, express.static(filename)); + GBLog.info(`Theme (.gbtheme) assets accessible at: /themes/${filenameOnly}.`); } else if (Path.extname(filename) === '.gbkb') { - server.use('/kb/' + filenameOnly + '/subjects', express.static(UrlJoin(filename, 'subjects'))); - GBLog.info(`KB (.gbkb) assets accessible at: ${'/kb/' + filenameOnly}.`); + server.use(`/kb/${filenameOnly}/subjects`, express.static(urlJoin(filename, 'subjects'))); + GBLog.info(`KB (.gbkb) assets accessible at: /kb/${filenameOnly}.`); } else if (Path.extname(filename) === '.gbui') { // Already Handled } else if (Path.extname(filename) === '.gbdialog') { @@ -387,7 +345,7 @@ export class GBDeployer { GBLog.info(`Waiting for package deployment...`); cb(totalPackages === generalPackages.length); }) - .done(result => { + .done(() => { if (botPackages.length === 0) { GBLog.info('Use ADDITIONAL_DEPLOY_PATH to point to a .gbai package folder (no external packages).'); } else { diff --git a/packages/core.gbapp/services/GBImporterService.ts b/packages/core.gbapp/services/GBImporterService.ts index 515296dd..187d9c5b 100644 --- a/packages/core.gbapp/services/GBImporterService.ts +++ b/packages/core.gbapp/services/GBImporterService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,13 +36,14 @@ 'use strict'; -import { IGBCoreService, IGBInstance } from 'botlib'; +import { IGBCoreService } from 'botlib'; import fs = require('fs'); -import path = require('path'); -import UrlJoin = require('url-join'); -import { SecService } from '../../security.gblib/services/SecService'; +import urlJoin = require('url-join'); import { GuaribasInstance } from '../models/GBModel'; +/** + * Handles the importing of packages. + */ export class GBImporter { public core: IGBCoreService; @@ -51,25 +52,25 @@ export class GBImporter { } public async importIfNotExistsBotPackage(botId: string, packageName: string, localPath: string) { - const packageJson = JSON.parse(fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8')); - if (!botId) { + const packageJson = JSON.parse(fs.readFileSync(urlJoin(localPath, 'package.json'), 'utf8')); + if (botId !== undefined) { botId = packageJson.botId; } const instance = await this.core.loadInstance(botId); - if (instance) { + if (instance !== undefined) { return instance; } else { - return await this.createInstanceInternal(botId, packageName, localPath, packageJson); + return await this.createInstanceInternal(botId, localPath, packageJson); } } - private async createInstanceInternal(botId: string, packageName: string, localPath: string, packageJson: any) { - const settings = JSON.parse(fs.readFileSync(UrlJoin(localPath, 'settings.json'), 'utf8')); - const servicesJson = JSON.parse(fs.readFileSync(UrlJoin(localPath, 'services.json'), 'utf8')); + private async createInstanceInternal(botId: string, localPath: string, packageJson: any) { + const settings = JSON.parse(fs.readFileSync(urlJoin(localPath, 'settings.json'), 'utf8')); + const servicesJson = JSON.parse(fs.readFileSync(urlJoin(localPath, 'services.json'), 'utf8')); packageJson = { ...packageJson, ...settings, ...servicesJson }; - if (botId) { + if (botId !== undefined) { packageJson.botId = botId; } diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index fa6471c6..73f31f34 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -37,7 +37,7 @@ 'use strict'; const { DialogSet, TextPrompt } = require('botbuilder-dialogs'); -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); const express = require('express'); const request = require('request-promise-native'); @@ -46,20 +46,31 @@ const AuthenticationContext = require('adal-node').AuthenticationContext; import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder'; import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs'; -import { GBDialogStep, GBLog, GBMinInstance, IGBAdminService, IGBConversationalService, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; +import { + GBDialogStep, + GBLog, + GBMinInstance, + IGBAdminService, + IGBConversationalService, + IGBCoreService, + IGBInstance, + IGBPackage +} from 'botlib'; + import { GBAnalyticsPackage } from '../../analytics.gblib'; import { GBCorePackage } from '../../core.gbapp'; import { GBCustomerSatisfactionPackage } from '../../customer-satisfaction.gbapp'; import { GBKBPackage } from '../../kb.gbapp'; +import { AskDialogArgs } from '../../kb.gbapp/dialogs/AskDialog'; import { GBSecurityPackage } from '../../security.gblib'; import { GBWhatsappPackage } from '../../whatsapp.gblib'; -import { GuaribasInstance } from '../models/GBModel'; import { Messages } from '../strings'; import { GBAdminPackage } from './../../admin.gbapp/index'; import { GBDeployer } from './GBDeployer'; -/** Minimal service layer for a bot. */ - +/** + * Minimal service layer for a bot. + */ export class GBMinService { public core: IGBCoreService; public conversationalService: IGBConversationalService; @@ -94,7 +105,7 @@ export class GBMinService { * * @return Loaded minimal bot instance. * - * */ + */ public async buildMin( bootInstance: IGBInstance, @@ -106,7 +117,7 @@ export class GBMinService { // Serves default UI on root address '/'. const uiPackage = 'default.gbui'; - server.use('/', express.static(UrlJoin(GBDeployer.deployFolder, uiPackage, 'build'))); + server.use('/', express.static(urlJoin(GBDeployer.deployFolder, uiPackage, 'build'))); await Promise.all( instances.map(async instance => { @@ -129,7 +140,7 @@ export class GBMinService { // Install default VBA module. - deployer.deployPackageFromLocalPath(min, 'packages/default.gbdialog'); + deployer.deployPackage(min, 'packages/default.gbdialog'); // Call the loadBot context.activity for all packages. @@ -146,10 +157,9 @@ export class GBMinService { // Serves individual URL for each bot user interface. const uiUrl = `/${instance.botId}`; - server.use(uiUrl, express.static(UrlJoin(GBDeployer.deployFolder, uiPackage, 'build'))); + server.use(uiUrl, express.static(urlJoin(GBDeployer.deployFolder, uiPackage, 'build'))); GBLog.info(`Bot UI ${uiPackage} accessible at: ${uiUrl}.`); - const state = `${instance.instanceId}${Math.floor(Math.random() * 1000000000)}`; // Clients get redirected here in order to create an OAuth authorize url and redirect them to AAD. // There they will authenticate and give their consent to allow this app access to @@ -175,12 +185,12 @@ export class GBMinService { throw new Error(msg); } const authenticationContext = new AuthenticationContext( - UrlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant) + urlJoin(min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant) ); const resource = 'https://graph.microsoft.com'; authenticationContext.acquireTokenWithAuthorizationCode( req.query.code, - UrlJoin(instance.botEndpoint, min.instance.botId, '/token'), + urlJoin(instance.botEndpoint, min.instance.botId, '/token'), resource, instance.authenticatorClientId, instance.authenticatorClientSecret, @@ -193,7 +203,7 @@ export class GBMinService { await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); await this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); await this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); - await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', null); + await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', undefined); res.redirect(min.instance.botEndpoint); } } @@ -202,15 +212,15 @@ export class GBMinService { } private handleOAuthRequests(server: any, min: GBMinInstance) { - server.get(`/${min.instance.botId}/auth`, function(req, res) { - let authorizationUrl = UrlJoin( + server.get(`/${min.instance.botId}/auth`, (req, res) => { + let authorizationUrl = urlJoin( min.instance.authenticatorAuthorityHostUrl, min.instance.authenticatorTenant, '/oauth2/authorize' ); authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${ min.instance.authenticatorClientId - }&redirect_uri=${UrlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; + }&redirect_uri=${urlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`; res.redirect(authorizationUrl); }); } @@ -224,10 +234,10 @@ export class GBMinService { botId = bootInstance.botId; } const instance = await this.core.loadInstance(botId); - if (instance) { + if (instance !== undefined) { const speechToken = await this.getSTSToken(instance); let theme = instance.theme; - if (!theme) { + if (theme !== undefined) { theme = 'default.gbtheme'; } res.send( @@ -284,7 +294,6 @@ export class GBMinService { * */ private async getSTSToken(instance: any) { - // TODO: Make dynamic: https://CHANGE.api.cognitive.microsoft.com/sts/v1.0 const options = { url: 'https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken', @@ -337,7 +346,7 @@ export class GBMinService { } private invokeLoadBot(appPackages: any[], min: GBMinInstance, server: any) { - const sysPackages = new Array(); + const sysPackages : IGBPackage[] = undefined; // NOTE: A semicolon is necessary before this line. [ GBCorePackage, @@ -354,7 +363,7 @@ export class GBMinService { if (sysPackage.name === 'GBWhatsappPackage') { const url = '/instances/:botId/whatsapp'; server.post(url, (req, res) => { - p['channel'].received(req, res); + (p as any).channel.received(req, res); }); } }, this); @@ -385,9 +394,8 @@ export class GBMinService { ) { await adapter.processActivity(req, res, async context => { // Get loaded user state - const state = await conversationState.get(context); const step = await min.dialogs.createContext(context); - step.context.activity.locale = 'en-US'; // TODO: Make dynamic. + step.context.activity.locale = 'en-US'; try { const user = await min.userProfile.get(context, {}); @@ -401,7 +409,7 @@ export class GBMinService { }); user.loaded = true; user.subjects = []; - user.cb = null; + user.cb = undefined; await min.userProfile.set(step.context, user); } @@ -433,8 +441,6 @@ export class GBMinService { } else if (context.activity.type === 'event') { // Empties dialog stack before going to the target. - // TODO: Understand MSFT changes: await step.endAll(); - await this.processEventActivity(context, step); } await conversationState.saveChanges(context, true); @@ -460,7 +466,7 @@ export class GBMinService { } else if (context.activity.name === 'showFAQ') { await step.beginDialog('/faq'); } else if (context.activity.name === 'answerEvent') { - await step.beginDialog('/answerEvent', { + await step.beginDialog('/answerEvent', { questionId: context.activity.data, fromFaq: true }); @@ -493,13 +499,11 @@ export class GBMinService { // Checks for /menu JSON signature. } else if (context.activity.text.startsWith('{"title"')) { - await step.beginDialog('/menu', { - data: JSON.parse(context.activity.text) - }); + await step.beginDialog('/menu', JSON.parse(context.activity.text)); // Otherwise, continue to the active dialog in the stack. } else { const user = await min.userProfile.get(context, {}); - if (step.activeDialog) { + if (step.activeDialog !== undefined) { await step.continueDialog(); } else { await step.beginDialog('/answer', { diff --git a/packages/core.gbapp/services/GBVMService.ts b/packages/core.gbapp/services/GBVMService.ts index 715fab13..68357f48 100644 --- a/packages/core.gbapp/services/GBVMService.ts +++ b/packages/core.gbapp/services/GBVMService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -41,8 +41,9 @@ import { TSCompiler } from './TSCompiler'; const walkPromise = require('walk-promise'); const vm = require('vm'); -import UrlJoin = require('url-join'); -import DialogClass from './GBAPIService'; +import urlJoin = require('url-join'); +import { DialogClass } from './GBAPIService'; +//tslint:disable-next-line:no-submodule-imports const vb2ts = require('vbscript-to-typescript/dist/converter'); const beautify = require('js-beautify').js; @@ -55,11 +56,13 @@ const beautify = require('js-beautify').js; * translation and enhance classic BASIC experience. */ +/** + * Basic services for BASIC manipulation. + */ export class GBVMService extends GBService { private readonly script = new vm.Script(); public async loadDialogPackage(folder: string, min: GBMinInstance, core: IGBCoreService, deployer: GBDeployer) { - const files = await walkPromise(folder); this.addHearDialog(min); @@ -74,7 +77,7 @@ export class GBVMService extends GBService { const mainName = file.name.replace(/\-|\./g, ''); min.scriptMap[file.name] = mainName; - const filename = UrlJoin(folder, file.name); + const filename = urlJoin(folder, file.name); fs.watchFile(filename, async () => { await this.run(filename, min, deployer, mainName); }); @@ -131,7 +134,7 @@ export class GBVMService extends GBService { // Converts General Bots BASIC into regular VBS const basicCode: string = fs.readFileSync(filename, 'utf8'); - const vbsCode = await this.convertGBASICToVBS(basicCode); + const vbsCode = this.convertGBASICToVBS(basicCode); const vbsFile = `${filename}.compiled`; fs.writeFileSync(vbsFile, vbsCode, 'utf8'); @@ -160,9 +163,9 @@ export class GBVMService extends GBService { let parsedCode = code; const hearExp = /(\w+).*hear.*\(\)/; - let match1; + let match1 = hearExp.exec(code); - while ((match1 = hearExp.exec(code))) { + while (match1 !== undefined) { let pos = 0; // Writes async body. @@ -182,8 +185,9 @@ export class GBVMService extends GBService { let right = 0; let left = 1; - let match2; - while ((match2 = /\{|\}/.exec(tempCode))) { + let match2 = /\{|\}/.exec(tempCode); + + while (match2 !== undefined) { const c = tempCode.substring(match2.index, match2.index + 1); if (c === '}') { @@ -198,6 +202,7 @@ export class GBVMService extends GBService { if (left === right) { break; } + match1 = hearExp.exec(code); } parsedCode += code.substring(start + match1[0].length + 1, pos + match1[0].length); @@ -207,6 +212,7 @@ export class GBVMService extends GBService { // A interaction will be made for each hear. code = parsedCode; + match2 = /\{|\}/.exec(tempCode); } parsedCode = this.handleThisAndAwait(parsedCode); @@ -218,7 +224,6 @@ export class GBVMService extends GBService { const context = vm.createContext(sandbox); vm.runInContext(parsedCode, context); min.sandBoxMap[mainName] = sandbox; - await deployer.deployScriptToStorage(1, filename); // TODO: Per bot storage. GBLog.info(`[GBVMService] Finished loading of ${filename}`); } } @@ -228,13 +233,13 @@ export class GBVMService extends GBService { code = code.replace(/sys\(\)/g, 'this.sys()'); code = code.replace(/("[^"]*"|'[^']*')|\btalk\b/g, ($0, $1) => { - return $1 == undefined ? 'this.talk' : $1; + return $1 === undefined ? 'this.talk' : $1; }); code = code.replace(/("[^"]*"|'[^']*')|\bhear\b/g, ($0, $1) => { - return $1 == undefined ? 'this.hear' : $1; + return $1 === undefined ? 'this.hear' : $1; }); code = code.replace(/("[^"]*"|'[^']*')|\bsendEmail\b/g, ($0, $1) => { - return $1 == undefined ? 'this.sendEmail' : $1; + return $1 === undefined ? 'this.sendEmail' : $1; }); // await insertion. @@ -249,7 +254,7 @@ export class GBVMService extends GBService { min.dialogs.add( new WaterfallDialog('/hear', [ async step => { - step.activeDialog.state.cbId = step.options['id']; + step.activeDialog.state.cbId = (step.options as any).id; return await step.prompt('textPrompt', {}); }, @@ -259,7 +264,7 @@ export class GBVMService extends GBService { const cbId = step.activeDialog.state.cbId; const cb = min.cbMap[cbId]; - cb.bind({ step: step, context: step.context }); // TODO: Necessary or min.sandbox? + cb.bind({ step: step, context: step.context }); await step.endDialog(); diff --git a/packages/core.gbapp/services/TSCompiler.ts b/packages/core.gbapp/services/TSCompiler.ts index 7d5185e8..00ccc045 100644 --- a/packages/core.gbapp/services/TSCompiler.ts +++ b/packages/core.gbapp/services/TSCompiler.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,9 +36,12 @@ 'use strict'; -import * as ts from 'typescript'; import { GBLog } from 'botlib'; +import * as ts from 'typescript'; +/** + * Wrapper for a TypeScript compiler. + */ export class TSCompiler { private static shouldIgnoreError(diagnostic) { @@ -75,7 +78,7 @@ export class TSCompiler { if (!TSCompiler.shouldIgnoreError(diagnostic)) { const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); - if (diagnostic.file) { + if (diagnostic.file !== undefined) { const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); GBLog.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { diff --git a/packages/core.gbapp/tests/core.test.ts b/packages/core.gbapp/tests/core.test.ts index 838d5f2d..00da8ce8 100644 --- a/packages/core.gbapp/tests/core.test.ts +++ b/packages/core.gbapp/tests/core.test.ts @@ -1,13 +1,9 @@ - import { expect } from 'chai'; -import 'mocha'; -import {GBImporter} from '../services/GBImporterService'; +import { GBImporter } from '../services/GBImporterService'; describe('Hello function', () => { - it('should return empty test', () => { - const service = new GBImporter(null); - //service.importIfNotExistsBotPackage(null, null); + const service = new GBImporter(undefined); const result = 0; expect(result).to.equal(0); }); diff --git a/packages/core.gbapp/tests/vm.test.ts b/packages/core.gbapp/tests/vm.test.ts index 1be437b2..67ecffeb 100644 --- a/packages/core.gbapp/tests/vm.test.ts +++ b/packages/core.gbapp/tests/vm.test.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -42,9 +42,7 @@ import { GBVMService } from '../services/GBVMService'; describe('Load function', () => { it('should fail on invalid file', () => { try { - // const service = new GBVMService(); - // TODO: service.loadJS('invalid.file', null, null, null, null); - + const service = new GBVMService(); } catch (error) { expect(error).to.equal(0); } diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index 96cdd6e7..b5ce198d 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -38,12 +38,14 @@ import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance } from 'botlib'; -import { IGBDialog } from 'botlib'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { AzureText } from 'pragmatismo-io-framework'; import { CSService } from '../services/CSService'; import { Messages } from '../strings'; +/** + * Dialog for feedback collecting. + */ export class FeedbackDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -59,13 +61,6 @@ export class FeedbackDialog extends IGBDialog { async step => { const locale = step.context.activity.locale; - // TODO: Migrate to 4.*+ await step.prompt("choicePrompt", Messages[locale].what_about_me, [ - // "1", - // "2", - // "3", - // "4", - // "5" - // ]); return await step.next(); }, async step => { @@ -86,30 +81,26 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; await step.context.sendActivity(Messages[locale].about_suggestions); - step.activeDialog.state.cbId = step.options['id']; + step.activeDialog.state.cbId = (step.options as any).id; return await step.prompt('textPrompt', Messages[locale].what_about_service); }, async step => { - const locale = step.context.activity.locale; const rate = await AzureText.getSentiment( - min.instance.textAnalyticsKey, - min.instance.textAnalyticsEndpoint, - min.conversationalService.getCurrentLanguage(step), - step.result + min.instance.textAnalyticsKey, + min.instance.textAnalyticsEndpoint, + min.conversationalService.getCurrentLanguage(step), + step.result ); if (rate > 0.5) { await step.context.sendActivity(Messages[locale].glad_you_liked); } else { await step.context.sendActivity(Messages[locale].we_will_improve); - - // TODO: Record. - } + } return await step.replaceDialog('/ask', { isReturning: true }); - } ]) ); diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index 09b962fd..b9c4ce5e 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,14 +36,16 @@ 'use strict'; -import { IGBDialog } from 'botlib'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { GBMinInstance } from 'botlib'; import { CSService } from '../services/CSService'; import { Messages } from '../strings'; +/** + * Dialog for collecting quality of answer. + */ export class QualityDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -62,11 +64,11 @@ export class QualityDialog extends IGBDialog { const score = step.result; setTimeout( - () => min.conversationalService.sendEvent(step, 'stop', null), + () => min.conversationalService.sendEvent(step, 'stop', undefined), 400 ); - if (score == 0) { + if (score === 0) { await step.context.sendActivity(Messages[locale].im_sorry_lets_try); } else { await step.context.sendActivity(Messages[locale].great_thanks); diff --git a/packages/customer-satisfaction.gbapp/index.ts b/packages/customer-satisfaction.gbapp/index.ts index 3850b5d9..052e1ac9 100644 --- a/packages/customer-satisfaction.gbapp/index.ts +++ b/packages/customer-satisfaction.gbapp/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,16 +36,19 @@ 'use strict'; -import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; -import UrlJoin = require('url-join'); +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; +import urlJoin = require('url-join'); import { FeedbackDialog } from './dialogs/FeedbackDialog'; import { QualityDialog } from './dialogs/QualityDialog'; import { GuaribasQuestionAlternate } from './models/index'; import { Sequelize } from 'sequelize-typescript'; +/** + * Package for customer-satisfaction.gblib. + */ export class GBCustomerSatisfactionPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); } diff --git a/packages/customer-satisfaction.gbapp/models/index.ts b/packages/customer-satisfaction.gbapp/models/index.ts index afcd21e8..f6298e52 100644 --- a/packages/customer-satisfaction.gbapp/models/index.ts +++ b/packages/customer-satisfaction.gbapp/models/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,33 +36,20 @@ 'use strict'; -import { - DataTypeDate, - DataTypeDecimal, - DataTypes, - DataTypeUUIDv4 -} from 'sequelize'; - import { AutoIncrement, BelongsTo, - BelongsToMany, Column, - CreatedAt, - DataType, ForeignKey, - HasMany, - IsUUID, - Length, Model, PrimaryKey, - Sequelize, - Table, - UpdatedAt -} from 'sequelize-typescript'; + Table} from 'sequelize-typescript'; import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; +/** + * List of saved alternate questions. + */ @Table export class GuaribasQuestionAlternate extends Model { diff --git a/packages/customer-satisfaction.gbapp/services/CSService.ts b/packages/customer-satisfaction.gbapp/services/CSService.ts index 0a8b424c..4ef113e9 100644 --- a/packages/customer-satisfaction.gbapp/services/CSService.ts +++ b/packages/customer-satisfaction.gbapp/services/CSService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -33,6 +33,9 @@ import { GuaribasConversation } from '../../analytics.gblib/models'; import { GuaribasQuestionAlternate } from '../models'; +/** + * Customer Satisfaction Service Layer. + */ export class CSService { public async resolveQuestionAlternate( diff --git a/packages/default.gbui/public/css/pragmatismo.css b/packages/default.gbui/public/css/pragmatismo.css index 7f415475..f258e644 100644 --- a/packages/default.gbui/public/css/pragmatismo.css +++ b/packages/default.gbui/public/css/pragmatismo.css @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/public/index.html b/packages/default.gbui/public/index.html index afca6481..b7d3c364 100644 --- a/packages/default.gbui/public/index.html +++ b/packages/default.gbui/public/index.html @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/GBUIApp.js b/packages/default.gbui/src/GBUIApp.js index 588ac9fe..20df55b4 100644 --- a/packages/default.gbui/src/GBUIApp.js +++ b/packages/default.gbui/src/GBUIApp.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/components/ChatPane.js b/packages/default.gbui/src/components/ChatPane.js index abe17888..d77961a2 100644 --- a/packages/default.gbui/src/components/ChatPane.js +++ b/packages/default.gbui/src/components/ChatPane.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/components/Footer.js b/packages/default.gbui/src/components/Footer.js index 0cfaa9b2..09b149af 100644 --- a/packages/default.gbui/src/components/Footer.js +++ b/packages/default.gbui/src/components/Footer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/components/GBCss.js b/packages/default.gbui/src/components/GBCss.js index c5dc69f1..09ba58ee 100644 --- a/packages/default.gbui/src/components/GBCss.js +++ b/packages/default.gbui/src/components/GBCss.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/components/NavBar.js b/packages/default.gbui/src/components/NavBar.js index 6c2e49eb..2a8a00e0 100644 --- a/packages/default.gbui/src/components/NavBar.js +++ b/packages/default.gbui/src/components/NavBar.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/components/SidebarMenu.js b/packages/default.gbui/src/components/SidebarMenu.js index fda919d2..43fa3ee2 100644 --- a/packages/default.gbui/src/components/SidebarMenu.js +++ b/packages/default.gbui/src/components/SidebarMenu.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/index.js b/packages/default.gbui/src/index.js index 6d320a9c..9c82fac3 100644 --- a/packages/default.gbui/src/index.js +++ b/packages/default.gbui/src/index.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/players/GBBulletPlayer.js b/packages/default.gbui/src/players/GBBulletPlayer.js index 46cabc34..48304c27 100644 --- a/packages/default.gbui/src/players/GBBulletPlayer.js +++ b/packages/default.gbui/src/players/GBBulletPlayer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/players/GBImagePlayer.js b/packages/default.gbui/src/players/GBImagePlayer.js index 6e337985..f2f3a54d 100644 --- a/packages/default.gbui/src/players/GBImagePlayer.js +++ b/packages/default.gbui/src/players/GBImagePlayer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/players/GBLoginPlayer.js b/packages/default.gbui/src/players/GBLoginPlayer.js index c5ed0fbd..4274c55a 100644 --- a/packages/default.gbui/src/players/GBLoginPlayer.js +++ b/packages/default.gbui/src/players/GBLoginPlayer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/players/GBMarkdownPlayer.js b/packages/default.gbui/src/players/GBMarkdownPlayer.js index 90d0efd7..5b108107 100644 --- a/packages/default.gbui/src/players/GBMarkdownPlayer.js +++ b/packages/default.gbui/src/players/GBMarkdownPlayer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/players/GBPowerBIPlayer.js b/packages/default.gbui/src/players/GBPowerBIPlayer.js index 284c65f0..ad30195c 100644 --- a/packages/default.gbui/src/players/GBPowerBIPlayer.js +++ b/packages/default.gbui/src/players/GBPowerBIPlayer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/default.gbui/src/players/GBVideoPlayer.js b/packages/default.gbui/src/players/GBVideoPlayer.js index e10c279f..8de4dcd0 100644 --- a/packages/default.gbui/src/players/GBVideoPlayer.js +++ b/packages/default.gbui/src/players/GBVideoPlayer.js @@ -2,14 +2,14 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | | | | General Bots Copyright (c) Pragmatismo.io. All rights reserved. | | Licensed under the AGPL-3.0. | -| | +| | | According to our dual licensing model, this program can be used either | | under the terms of the GNU Affero General Public License, version 3, | | or under a proprietary license. | diff --git a/packages/kb.gbapp/dialogs/AskDialog.ts b/packages/kb.gbapp/dialogs/AskDialog.ts index 5be2cace..e940d97c 100644 --- a/packages/kb.gbapp/dialogs/AskDialog.ts +++ b/packages/kb.gbapp/dialogs/AskDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -38,12 +38,22 @@ import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { IGBDialog, GBLog } from 'botlib'; -import { GBMinInstance } from 'botlib'; +import { GBLog, GBMinInstance, IGBDialog } from 'botlib'; import { AzureText } from 'pragmatismo-io-framework'; import { Messages } from '../strings'; import { KBService } from './../services/KBService'; +/** + * Dialog arguments. + */ +export class AskDialogArgs { + public questionId: number; + public fromFaq: boolean; +} + +/** + * Handle the ask loop on knowledge base data or delegate to other services. + */ export class AskDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -53,159 +63,135 @@ export class AskDialog extends IGBDialog { */ public static setup(bot: BotAdapter, min: GBMinInstance) { const service = new KBService(min.core.sequelize); + min.dialogs.add(new WaterfallDialog('/answerEvent', AskDialog.getAnswerEventDialog(service, min))); + min.dialogs.add(new WaterfallDialog('/answer', AskDialog.getAnswerDialog(min, service))); + min.dialogs.add(new WaterfallDialog('/ask', AskDialog.getAskDialog(min))); + } - min.dialogs.add( - new WaterfallDialog('/answerEvent', [ - async step => { - if (step.options && step.options['questionId']) { - const question = await service.getQuestionById(min.instance.instanceId, step.options['questionId']); - const answer = await service.getAnswerById(min.instance.instanceId, question.answerId); - - // Sends the answer to all outputs, including projector. - - await service.sendAnswer(min.conversationalService, step, answer); - - await step.replaceDialog('/ask', { isReturning: true }); - } + private static getAskDialog(min: GBMinInstance) { + return [ + async step => { + const locale = step.context.activity.locale; + const user = await min.userProfile.get(step.context, {}); + user.isAsking = true; + if (!user.subjects) { + user.subjects = []; + } + let text; + // Three forms of asking. + if (step.options && step.options.firstTime) { + text = Messages[locale].ask_first_time; + } else if (step.options && step.options.isReturning) { + text = Messages[locale].anything_else; + } else if (user.subjects.length > 0) { + text = Messages[locale].which_question; + } else { + throw new Error('Invalid use of /ask'); + } + if (text.length > 0) { + return await step.prompt('textPrompt', text); + } + return await step.next(); + }, + async step => { + if (step.result) { + return await step.replaceDialog('/answer', { query: step.result }); + } else { return await step.next(); } - ]) - ); + } + ]; + } - min.dialogs.add( - new WaterfallDialog('/answer', [ - async step => { - const user = await min.userProfile.get(step.context, {}); - let text = step.options['query']; - if (!text) { - throw new Error(`/answer being called with no args query text.`); + private static getAnswerDialog(min: GBMinInstance, service: KBService) { + return [ + async step => { + const user = await min.userProfile.get(step.context, {}); + let text = step.options.query; + if (!text) { + throw new Error(`/answer being called with no args query text.`); + } + const locale = step.context.activity.locale; + // Stops any content on projector. + await min.conversationalService.sendEvent(step, 'stop', undefined); + // Handle extra text from FAQ. + if (step.options && step.options.query) { + text = step.options.query; + } else if (step.options && step.options.fromFaq) { + await step.context.sendActivity(Messages[locale].going_answer); + } + // Spells check the input text before sending Search or NLP. + if (min.instance.spellcheckerKey !== undefined) { + const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text); + if (data !== text) { + GBLog.info(`Spelling corrected: ${data}`); + text = data; } + } - const locale = step.context.activity.locale; + // Searches KB for the first time. + user.lastQuestion = text; + await min.userProfile.set(step.context, user); + const resultsA = await service.ask(min.instance, text, min.instance.searchScore, user.subjects); - // Stops any content on projector. - - await min.conversationalService.sendEvent(step, 'stop', null); - - // Handle extra text from FAQ. - - if (step.options && step.options['query']) { - text = step.options['query']; - } else if (step.options && step.options['fromFaq']) { - await step.context.sendActivity(Messages[locale].going_answer); - } - - // Spells check the input text before sending Search or NLP. - - if (min.instance.spellcheckerKey) { - const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text); - - if (data != text) { - GBLog.info(`Spelling corrected: ${data}`); - text = data; - } - } - - // Searches KB for the first time. - - user.lastQuestion = text; + // If there is some result, answer immediately. + if (resultsA !== undefined && resultsA.answer !== undefined) { + // Saves some context info. + user.isAsking = false; + user.lastQuestionId = resultsA.questionId; await min.userProfile.set(step.context, user); - const resultsA = await service.ask(min.instance, text, min.instance.searchScore, user.subjects); + // Sends the answer to all outputs, including projector. + await service.sendAnswer(min.conversationalService, step, resultsA.answer); + + // Goes to ask loop, again. + return await step.replaceDialog('/ask', { isReturning: true }); + } else { + // Second time running Search, now with no filter. + const resultsB = await service.ask(min.instance, text, min.instance.searchScore, undefined); // If there is some result, answer immediately. - if (resultsA && resultsA.answer) { + if (resultsB !== undefined && resultsB.answer !== undefined) { // Saves some context info. - - user.isAsking = false; - user.lastQuestionId = resultsA.questionId; - await min.userProfile.set(step.context, user); - + const user2 = await min.userProfile.get(step.context, {}); + user2.isAsking = false; + user2.lastQuestionId = resultsB.questionId; + await min.userProfile.set(step.context, user2); + // Informs user that a broader search will be used. + if (user2.subjects.length > 0) { + await step.context.sendActivity(Messages[locale].wider_answer); + } // Sends the answer to all outputs, including projector. - - await service.sendAnswer(min.conversationalService, step, resultsA.answer); - - // Goes to ask loop, again. + await service.sendAnswer(min.conversationalService, step, resultsB.answer); return await step.replaceDialog('/ask', { isReturning: true }); } else { - // Second time running Search, now with no filter. - - const resultsB = await service.ask(min.instance, text, min.instance.searchScore, null); - - // If there is some result, answer immediately. - - if (resultsB && resultsB.answer) { - // Saves some context info. - - const user = await min.userProfile.get(step.context, {}); - user.isAsking = false; - user.lastQuestionId = resultsB.questionId; - await min.userProfile.set(step.context, user); - - // Informs user that a broader search will be used. - - if (user.subjects.length > 0) { - const subjectText = `${KBService.getSubjectItemsSeparatedBySpaces(user.subjects)}`; - await step.context.sendActivity(Messages[locale].wider_answer); - } - - // Sends the answer to all outputs, including projector. - - await service.sendAnswer(min.conversationalService, step, resultsB.answer); + if (!(await min.conversationalService.routeNLP(step, min, text))) { + await step.context.sendActivity(Messages[locale].did_not_find); return await step.replaceDialog('/ask', { isReturning: true }); - } else { - if (!(await min.conversationalService.routeNLP(step, min, text))) { - await step.context.sendActivity(Messages[locale].did_not_find); - - return await step.replaceDialog('/ask', { isReturning: true }); - } } } } - ]) - ); + } + ]; + } - min.dialogs.add( - new WaterfallDialog('/ask', [ - async step => { - const locale = step.context.activity.locale; - const user = await min.userProfile.get(step.context, {}); - user.isAsking = true; - if (!user.subjects) { - user.subjects = []; - } - let text; - - // Three forms of asking. - - if (step.options && step.options['firstTime'] ) { - text = Messages[locale].ask_first_time; - } else if (step.options && step.options['isReturning']) { - text = Messages[locale].anything_else; - } else if (user.subjects.length > 0) { - text = Messages[locale].which_question; - } else { - throw new Error('Invalid use of /ask'); - } - - if (text.length > 0) { - return await step.prompt('textPrompt', text); - } - - return await step.next(); - }, - async step => { - if (step.result) { - return await step.replaceDialog('/answer', { query: step.result }); - } else { - return await step.next(); - } + private static getAnswerEventDialog(service: KBService, min: GBMinInstance) { + return [ + async step => { + const data = step.options as AskDialogArgs; + if (data !== undefined && data.questionId !== undefined) { + const question = await service.getQuestionById(min.instance.instanceId, data.questionId); + const answer = await service.getAnswerById(min.instance.instanceId, question.answerId); + // Sends the answer to all outputs, including projector. + await service.sendAnswer(min.conversationalService, step, answer); + await step.replaceDialog('/ask', { isReturning: true }); } - ]) - ); + return await step.next(); + } + ]; } } diff --git a/packages/kb.gbapp/dialogs/FaqDialog.ts b/packages/kb.gbapp/dialogs/FaqDialog.ts index f2c18ebb..448d8b33 100644 --- a/packages/kb.gbapp/dialogs/FaqDialog.ts +++ b/packages/kb.gbapp/dialogs/FaqDialog.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -38,11 +38,13 @@ import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { IGBDialog } from 'botlib'; -import { GBMinInstance } from 'botlib'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { Messages } from '../strings'; import { KBService } from './../services/KBService'; +/** + * Handle display of FAQ allowing direct access to KB. + */ export class FaqDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -56,9 +58,9 @@ export class FaqDialog extends IGBDialog { min.dialogs.add(new WaterfallDialog('/faq', [ async step => { - const data = await service.getFaqBySubjectArray('faq', null); + const data = await service.getFaqBySubjectArray('faq', undefined); const locale = step.context.activity.locale; - if (data) { + if (data !== undefined) { await min.conversationalService.sendEvent(step, 'play', { playerType: 'bullet', data: data.slice(0, 10) diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts index b020c189..9904fedc 100644 --- a/packages/kb.gbapp/dialogs/MenuDialog.ts +++ b/packages/kb.gbapp/dialogs/MenuDialog.ts @@ -1,9 +1,8 @@ - /*****************************************************************************\ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -37,17 +36,26 @@ 'use strict'; -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); import { BotAdapter, CardFactory, MessageFactory } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; -import { IGBDialog } from 'botlib'; -import { GBMinInstance } from 'botlib'; -import { AzureText } from 'pragmatismo-io-framework'; +import { GBMinInstance, IGBDialog } from 'botlib'; import { GuaribasSubject } from '../models'; import { KBService } from '../services/KBService'; import { Messages } from '../strings'; +/** + * Dialog arguments. + */ +export class MenuDialogArgs { + public to: string; + public subjectId: string; +} + +/** + * Dialogs for handling Menu control. + */ export class MenuDialog extends IGBDialog { /** * Setup dialogs flows and define services call. @@ -58,71 +66,54 @@ export class MenuDialog extends IGBDialog { public static setup(bot: BotAdapter, min: GBMinInstance) { const service = new KBService(min.core.sequelize); - min.dialogs.add(new WaterfallDialog('/menu', [ + min.dialogs.add(new WaterfallDialog('/menu', MenuDialog.getMenuDialog(min, service))); + } + + private static getMenuDialog(min: GBMinInstance, service: KBService) { + return [ async step => { const locale = step.context.activity.locale; - let rootSubjectId = null; + const user = await min.userProfile.get(step.context, {}); + const args: MenuDialogArgs = step.options; - if (step.options && step.options['data']) { - const subject = step.options ['data']; + let rootSubjectId; + if (args !== undefined) { // If there is a shortcut specified as subject destination, go there. + if (args.to !== undefined) { + const dialog = args.to.split(':')[1]; - if (subject.to) { - const dialog = subject.to.split(':')[1]; - await step.replaceDialog('/' + dialog); - await step.endDialog(); - - return; + return await step.replaceDialog(`/${dialog}`); } - // Adds to bot a perception of a new subject. - - const user = await min.userProfile.get(step.context, {}); - user.subjects.push(subject); - rootSubjectId = subject.subjectId; + user.subjects.push(args); + rootSubjectId = args.subjectId; // Whenever a subject is selected, shows a faq about it. - if (user.subjects.length > 0) { - const data = await service.getFaqBySubjectArray( - 'menu', - user.subjects - ); + const list = await service.getFaqBySubjectArray('menu', user.subjects); await min.conversationalService.sendEvent(step, 'play', { playerType: 'bullet', - data: data.slice(0, 10) + data: list.slice(0, 10) }); } } else { - const user = await min.userProfile.get(step.context, {}); user.subjects = []; - - await step.context.sendActivity(Messages[locale].here_is_subjects); // TODO: Handle rnd. + await step.context.sendActivity(Messages[locale].here_is_subjects); user.isAsking = false; } - const msg = MessageFactory.text(''); const attachments = []; - - const data = await service.getSubjectItems( - min.instance.instanceId, - rootSubjectId - ); - + const data = await service.getSubjectItems(min.instance.instanceId, rootSubjectId); msg.attachmentLayout = 'carousel'; - - data.forEach(function(item: GuaribasSubject) { + data.forEach((item: GuaribasSubject) => { const subject = item; const card = CardFactory.heroCard( subject.title, subject.description, - CardFactory.images([ - UrlJoin('/kb', min.instance.kb, 'subjects', 'subject.png') - ]), + CardFactory.images([urlJoin('/kb', min.instance.kb, 'subjects', 'subject.png')]), CardFactory.actions([ - { - channelData: null, + { type: 'postBack', title: Messages[locale].menu_select, value: JSON.stringify({ @@ -135,31 +126,23 @@ export class MenuDialog extends IGBDialog { } ]) ); - attachments.push(card); }); - if (attachments.length === 0) { - const user = await min.userProfile.get(step.context, {}); if (user.subjects && user.subjects.length > 0) { await step.context.sendActivity( - Messages[locale].lets_search( - KBService.getFormattedSubjectItems(user.subjects) - ) + Messages[locale].lets_search(KBService.getFormattedSubjectItems(user.subjects)) ); } - } else { msg.attachments = attachments; await step.context.sendActivity(msg); } - - const user = await min.userProfile.get(step.context, {}); user.isAsking = true; return await step.next(); } - ])); + ]; } } diff --git a/packages/kb.gbapp/index.ts b/packages/kb.gbapp/index.ts index 628c035e..9e727fd1 100644 --- a/packages/kb.gbapp/index.ts +++ b/packages/kb.gbapp/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,19 +36,18 @@ 'use strict'; -import UrlJoin = require('url-join'); - -import { GBDialogStep, GBLog, GBMinInstance, IGBPackage } from 'botlib'; -import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from './models/index'; - -import { IGBCoreService } from 'botlib'; +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { AskDialog } from './dialogs/AskDialog'; import { FaqDialog } from './dialogs/FaqDialog'; import { MenuDialog } from './dialogs/MenuDialog'; +import { GuaribasAnswer, GuaribasQuestion, GuaribasSubject } from './models/index'; +/** + * Package for kb.gbapp. + */ export class GBKBPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); } diff --git a/packages/kb.gbapp/models/index.ts b/packages/kb.gbapp/models/index.ts index df86b844..913c9df5 100644 --- a/packages/kb.gbapp/models/index.ts +++ b/packages/kb.gbapp/models/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -60,6 +60,9 @@ import { } from '../../core.gbapp/models/GBModel'; import { GuaribasUser } from '../../security.gblib/models'; +/** + * Subjects to group the pair of questions and answers. + */ @Table export class GuaribasSubject extends Model { @PrimaryKey @@ -111,6 +114,9 @@ export class GuaribasSubject extends Model { public package: GuaribasPackage; } +/** + * A question and its metadata. + */ @Table export class GuaribasQuestion extends Model { @PrimaryKey @@ -155,6 +161,7 @@ export class GuaribasQuestion extends Model { @UpdatedAt public updatedAt: Date; + //tslint:disable-next-line:no-use-before-declare @ForeignKey(() => GuaribasAnswer) @Column public answerId: number; @@ -174,6 +181,9 @@ export class GuaribasQuestion extends Model { public package: GuaribasPackage; } +/** + * An answer and its metadata. + */ @Table export class GuaribasAnswer extends Model { @PrimaryKey diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 70250f14..7b581b8f 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,14 +36,13 @@ const Path = require('path'); const Fs = require('fs'); -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); const marked = require('marked'); const path = require('path'); const asyncPromise = require('async-promises'); const walkPromise = require('walk-promise'); -// tslint:disable:no-unsafe-any +// tslint:disable-next-line:newline-per-chained-call const parse = require('bluebird').promisify(require('csv-parse')); -// tslint:enable:no-unsafe-any import { GBDialogStep, GBLog, IGBConversationalService, IGBCoreService, IGBInstance } from 'botlib'; import { AzureSearch } from 'pragmatismo-io-framework'; @@ -275,7 +274,7 @@ export class KBService { // Extracts answer from external media if any. if (answer.indexOf('.md') > -1) { - const mediaFilename = UrlJoin(path.dirname(filePath), '..', 'articles', answer); + const mediaFilename = urlJoin(path.dirname(filePath), '..', 'articles', answer); if (Fs.existsSync(mediaFilename)) { answer = Fs.readFileSync(mediaFilename, 'utf8'); format = '.md'; @@ -393,7 +392,7 @@ export class KBService { ): Promise { // Imports subjects tree into database and return it. - await this.importSubjectFile(packageStorage.packageId, UrlJoin(localPath, 'subjects.json'), instance); + await this.importSubjectFile(packageStorage.packageId, urlJoin(localPath, 'subjects.json'), instance); // Import all .tsv files in the tabular directory. @@ -401,12 +400,12 @@ export class KBService { } public async importKbTabularDirectory(localPath: string, instance: IGBInstance, packageId: number): Promise { - const files = await walkPromise(UrlJoin(localPath, 'tabular')); + const files = await walkPromise(urlJoin(localPath, 'tabular')); return Promise.all( files.map(async file => { if (file.name.endsWith('.tsv')) { - return this.importKbTabularFile(UrlJoin(file.root, file.name), instance.instanceId, packageId); + return this.importKbTabularFile(urlJoin(file.root, file.name), instance.instanceId, packageId); } }) ); @@ -465,7 +464,7 @@ export class KBService { const packageType = Path.extname(localPath); const packageName = Path.basename(localPath); GBLog.info(`[GBDeployer] Opening package: ${localPath}`); - const packageObject = JSON.parse(Fs.readFileSync(UrlJoin(localPath, 'package.json'), 'utf8')); + const packageObject = JSON.parse(Fs.readFileSync(urlJoin(localPath, 'package.json'), 'utf8')); const instance = await core.loadInstance(packageObject.botId); GBLog.info(`[GBDeployer] Importing: ${localPath}`); diff --git a/packages/security.gblib/index.ts b/packages/security.gblib/index.ts index cd54966f..6c589138 100644 --- a/packages/security.gblib/index.ts +++ b/packages/security.gblib/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,15 +36,18 @@ 'use strict'; -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models'; +/** + * Package for the security module. + */ export class GBSecurityPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public getDialogs(min: GBMinInstance) { GBLog.verbose(`getDialogs called.`); } diff --git a/packages/security.gblib/models/index.ts b/packages/security.gblib/models/index.ts index 784e8c97..e5e0e924 100644 --- a/packages/security.gblib/models/index.ts +++ b/packages/security.gblib/models/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -63,6 +63,9 @@ import { import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; +/** + * A user and its metadata. + */ @Table export class GuaribasUser extends Model { @PrimaryKey @@ -90,6 +93,9 @@ export class GuaribasUser extends Model { public instance: GuaribasInstance; } +/** + * A group of users. + */ @Table export class GuaribasGroup extends Model { @PrimaryKey @@ -109,6 +115,9 @@ export class GuaribasGroup extends Model { public instance: GuaribasInstance; } +/** + * Relation of groups and users. + */ @Table export class GuaribasUserGroup extends Model { @ForeignKey(() => GuaribasUser) diff --git a/packages/security.gblib/services/SecService.ts b/packages/security.gblib/services/SecService.ts index d1fee375..358da06b 100644 --- a/packages/security.gblib/services/SecService.ts +++ b/packages/security.gblib/services/SecService.ts @@ -1,28 +1,31 @@ const Fs = require('fs'); -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); import { GBService, IGBInstance } from 'botlib'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from '../models'; +/** + * Security service layer. + */ export class SecService extends GBService { public async importSecurityFile(localPath: string, instance: IGBInstance) { - const security = JSON.parse(Fs.readFileSync(UrlJoin(localPath, 'security.json'), 'utf8')); + const security = JSON.parse(Fs.readFileSync(urlJoin(localPath, 'security.json'), 'utf8')); security.groups.forEach(group => { const groupDb = GuaribasGroup.build({ instanceId: instance.instanceId, displayName: group.displayName }); - groupDb.save().then(groupDb => { + groupDb.save().then(g1 => { group.users.forEach(user => { const userDb = GuaribasUser.build({ instanceId: instance.instanceId, - groupId: groupDb.groupId, + groupId: g1.groupId, userName: user.userName }); - userDb.save().then(userDb => { + userDb.save().then(user2 => { const userGroup = GuaribasUserGroup.build(); - userGroup.groupId = groupDb.groupId; - userGroup.userId = userDb.userId; + userGroup.groupId = g1.groupId; + userGroup.userId = user2.userId; userGroup.save(); }); }); diff --git a/packages/whatsapp.gblib/index.ts b/packages/whatsapp.gblib/index.ts index fbb4e983..43f0a5ec 100644 --- a/packages/whatsapp.gblib/index.ts +++ b/packages/whatsapp.gblib/index.ts @@ -2,7 +2,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -36,22 +36,22 @@ 'use strict'; -import UrlJoin = require('url-join'); - -import { GBMinInstance, IGBCoreService, IGBPackage, GBLog, GBDialogStep } from 'botlib'; - +import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib'; import { Sequelize } from 'sequelize-typescript'; import { WhatsappDirectLine } from './services/WhatsappDirectLine'; +/** + * Package for whatsapp.gblib + */ export class GBWhatsappPackage implements IGBPackage { - public sysPackages: IGBPackage[] = undefined; + public sysPackages: IGBPackage[]; public channel: WhatsappDirectLine; public loadBot(min: GBMinInstance): void { // Only loads engine if it is defined on services.json. - if (min.instance.whatsappBotKey) { + if (min.instance.whatsappBotKey !== undefined) { this.channel = new WhatsappDirectLine( min.botId, min.instance.whatsappBotKey, @@ -63,9 +63,19 @@ export class GBWhatsappPackage implements IGBPackage { } } - public getDialogs(min: GBMinInstance) {GBLog.verbose (`getDialogs called.`);} - public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {GBLog.verbose (`loadPackage called.`);} - public unloadPackage(core: IGBCoreService): void {GBLog.verbose (`unloadPackage called.`);} - public unloadBot(min: GBMinInstance): void {GBLog.verbose (`unloadBot called.`);} - public onNewSession(min: GBMinInstance, step: GBDialogStep): void {GBLog.verbose (`onNewSession called.`);} + public getDialogs(min: GBMinInstance) { + GBLog.verbose(`getDialogs called.`); + } + public loadPackage(core: IGBCoreService, sequelize: Sequelize): void { + GBLog.verbose(`loadPackage called.`); + } + public unloadPackage(core: IGBCoreService): void { + GBLog.verbose(`unloadPackage called.`); + } + public unloadBot(min: GBMinInstance): void { + GBLog.verbose(`unloadBot called.`); + } + public onNewSession(min: GBMinInstance, step: GBDialogStep): void { + GBLog.verbose(`onNewSession called.`); + } } diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index c3d61aaf..444a8d82 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -1,10 +1,13 @@ -import UrlJoin = require('url-join'); +import urlJoin = require('url-join'); const Swagger = require('swagger-client'); const rp = require('request-promise'); -import { GBService, GBLog } from 'botlib'; +import { GBLog, GBService } from 'botlib'; import * as request from 'request-promise-native'; +/** + * Support for Whatsapp. + */ export class WhatsappDirectLine extends GBService { public pollInterval = 1000; public directLineClientName = 'DirectLineClient'; @@ -16,7 +19,7 @@ export class WhatsappDirectLine extends GBService { public whatsappServiceUrl: string; public whatsappServiceWebhookUrl: string; public botId: string; - public watermark: string = null; + public watermark: string; public conversationIds = {}; @@ -36,7 +39,6 @@ export class WhatsappDirectLine extends GBService { this.whatsappServiceUrl = whatsappServiceUrl; this.whatsappServiceWebhookUrl = whatsappServiceWebhookUrl; - // TODO: Migrate to Swagger 3. this.directLineClient = rp(this.directLineSpecUrl) .then(spec => { return new Swagger({ @@ -47,12 +49,12 @@ export class WhatsappDirectLine extends GBService { .then(async client => { client.clientAuthorizations.add( 'AuthorizationBotConnector', - new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header') + new Swagger.ApiKeyAuthorization('Authorization', `Bearer ${directLineSecret}`, 'header') ); const options = { method: 'POST', - url: UrlJoin(this.whatsappServiceUrl, 'webhook'), + url: urlJoin(this.whatsappServiceUrl, 'webhook'), qs: { token: this.whatsappServiceKey, webhookUrl: `${this.whatsappServiceWebhookUrl}/instances/${this.botId}/whatsapp`, @@ -64,7 +66,7 @@ export class WhatsappDirectLine extends GBService { }; try { - const result = await request.post(options); + const result = request.post(options); GBLog.info(result); } catch (error) { GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error}`); @@ -91,17 +93,17 @@ export class WhatsappDirectLine extends GBService { const conversationId = this.conversationIds[from]; this.directLineClient.then(client => { - if (this.conversationIds[from] == undefined) { + if (this.conversationIds[from] === undefined) { GBLog.info(`GBWhatsapp: Starting new conversation on Bot.`); client.Conversations.Conversations_StartConversation() .then(response => { return response.obj.conversationId; }) - .then(conversationId => { - this.conversationIds[from] = conversationId; - this.inputMessage(client, conversationId, text, from, fromName); + .then(generatedConversationId => { + this.conversationIds[from] = generatedConversationId; + this.inputMessage(client, generatedConversationId, text, from, fromName); - this.pollMessages(client, conversationId, from, fromName); + this.pollMessages(client, generatedConversationId, from, fromName); }) .catch(err => { GBLog.error(`Error starting conversation ${err}`); @@ -183,9 +185,11 @@ export class WhatsappDirectLine extends GBService { break; case 'image/png': - GBLog.info('Opening the requested image ' + attachment.contentUrl); + GBLog.info(`Opening the requested image ${attachment.contentUrl}`); output += `\n${attachment.contentUrl}`; break; + default: + GBLog.info(`Unknown content type: ${attachment.contentType}`); } }); } @@ -200,7 +204,7 @@ export class WhatsappDirectLine extends GBService { public async sendToDevice(to, msg) { const options = { method: 'POST', - url: UrlJoin(this.whatsappServiceUrl, 'message'), + url: urlJoin(this.whatsappServiceUrl, 'message'), qs: { token: this.whatsappServiceKey, phone: to, diff --git a/src/app.ts b/src/app.ts index a5b0ba64..d87c942d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -3,7 +3,7 @@ | ( )_ _ | | _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ | | ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ | -| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) | +| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| (˅) |( (_) ) | | | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' | | | | ( )_) | | | (_) \___/' | @@ -37,13 +37,12 @@ 'use strict'; -const logger = require('./logger'); const express = require('express'); const bodyParser = require('body-parser'); -import { IGBCoreService, IGBInstance, IGBPackage, GBLog } from 'botlib'; + +import { GBLog, IGBCoreService, IGBInstance, IGBPackage } from 'botlib'; import { GBAdminService } from '../packages/admin.gbapp/services/GBAdminService'; import { AzureDeployerService } from '../packages/azuredeployer.gbapp/services/AzureDeployerService'; -import { GuaribasInstance } from '../packages/core.gbapp/models/GBModel'; import { GBConfigService } from '../packages/core.gbapp/services/GBConfigService'; import { GBConversationalService } from '../packages/core.gbapp/services/GBConversationalService'; import { GBCoreService } from '../packages/core.gbapp/services/GBCoreService'; @@ -51,7 +50,7 @@ import { GBDeployer } from '../packages/core.gbapp/services/GBDeployer'; import { GBImporter } from '../packages/core.gbapp/services/GBImporterService'; import { GBMinService } from '../packages/core.gbapp/services/GBMinService'; -const appPackages = new Array(); +const appPackages: IGBPackage[] = undefined; /** * General Bots open-core entry point. @@ -68,7 +67,7 @@ export class GBServer { // bot instance. This allows the same server to attend multiple Bot on // the Marketplace until GB get serverless. - const port = process.env.port || process.env.PORT || 4242; + const port = GBConfigService.getServerPort(); const server = express(); server.use(bodyParser.json()); // to support JSON-encoded bodies @@ -79,7 +78,6 @@ export class GBServer { }) ); - let bootInstance: IGBInstance; server.listen(port, () => { (async () => { try { @@ -103,7 +101,7 @@ export class GBServer { // Creates a boot instance or load it from storage. - let bootInstance: IGBInstance = null; + let bootInstance: IGBInstance; try { await core.initStorage(); } catch (error) { @@ -132,7 +130,7 @@ export class GBServer { await core.saveInstance(fullInstance); let instances: IGBInstance[] = await core.loadAllInstances(core, azureDeployer, proxyAddress); instances = await core.ensureInstances(instances, bootInstance, core); - if (!bootInstance) { + if (bootInstance !== undefined) { bootInstance = instances[0]; } diff --git a/tslint.json b/tslint.json index 10699ef4..142f27d9 100644 --- a/tslint.json +++ b/tslint.json @@ -12,17 +12,20 @@ "rulesDirectory": ["node_modules/tslint-microsoft-contrib"], "jsRules": {}, "rules": { - "no-unsafe-any":false, "newline-per-chained-call": false, + "no-unsafe-any": false, "no-floating-promises": false, "no-var-requires": false, "typedef": false, "variable-name": false, "no-parameter-properties": false, + "max-line-length": [true, { "limit": 120, "ignore-pattern": "^\\s+\\*" }], + "await-promise": [true, "Bluebird"], "no-reserved-keywords": false, "no-unnecessary-class": false, "no-require-imports": false, "function-name": false, + "no-relative-imports": false, "no-redundant-jsdoc": false, "no-return-await": false, "prefer-type-cast": false, @@ -35,9 +38,6 @@ "switch-final-break": false, "no-parameter-reassignment": false, "export-name": false, - "no-relative-imports": false, - "no-backbone-get-set-outside-model": false, - "max-line-length": [true, { "limit": 120, "ignore-pattern": "^\\s+\\*" }], - "await-promise": [true, "Bluebird"] + "no-backbone-get-set-outside-model": false } } From c74b3ee97c7439f8fdb0d03ddbb5ef6320ef93e0 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 11 Mar 2019 19:32:47 -0300 Subject: [PATCH 24/32] fix(general): tslint being applied in all sources. --- package.json | 2 +- .../services/AzureDeployerService.ts | 20 +++++----- .../core.gbapp/services/GBConfigService.ts | 7 ++-- packages/core.gbapp/services/GBCoreService.ts | 37 ++++++++++--------- packages/core.gbapp/services/GBDeployer.ts | 6 +-- .../core.gbapp/services/GBImporterService.ts | 2 +- packages/core.gbapp/services/GBMinService.ts | 10 ++--- src/app.ts | 16 ++++---- 8 files changed, 51 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index d9123a41..3961eea5 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "request-promise": "4.2.4", "request-promise-native": "1.0.7", "scanf": "^1.0.2", - "sequelize": "4.43.0", + "sequelize": "^4.43.0", "sequelize-typescript": "0.6.7", "shx": "0.3.2", "simple-git": "1.107.0", diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index d59c2bf6..2f0dc36b 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -86,10 +86,9 @@ export class AzureDeployerService implements IGBInstallationDeployer { const req = new WebResource(); req.method = verb; req.url = url; - req.headers = {}; - req.headers['Content-Type'] = 'application/json'; - req.headers['accept-language'] = '*'; - req.headers.set(' Authorization', `Bearer ${accessToken}`); + req.headers.set('Content-Type', 'application/json'); + req.headers.set('accept-language', '*'); + req.headers.set('Authorization', `Bearer ${accessToken}`); req.body = body; return req; @@ -405,10 +404,10 @@ export class AzureDeployerService implements IGBInstallationDeployer { const req = new WebResource(); req.method = 'POST'; req.url = requestUrl; - req.headers = {}; + req.headers = {}; req.headers['Content-Type'] = 'application/json; charset=utf-8'; req.headers['accept-language'] = '*'; - req.headers.set('Authorization', `Bearer ${accessToken}`); + (req.headers as any).Authorization = `Bearer ${accessToken}`; } /** @@ -486,7 +485,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { } catch (error) { reject(error); } - }, 20000); + }, 20000); }); } @@ -527,10 +526,9 @@ export class AzureDeployerService implements IGBInstallationDeployer { const req = new WebResource(); req.method = method; req.url = `https://${location}.api.cognitive.microsoft.com/luis/api/v2.0/${resource}`; - req.headers = {}; - req.headers['Content-Type'] = 'application/json'; - req.headers['accept-language'] = '*'; - req.headers['Ocp-Apim-Subscription-Key'] = authoringKey; + req.headers.set('Content-Type', 'application/json'); + req.headers.set('accept-language', '*'); + req.headers.set('Ocp-Apim-Subscription-Key', authoringKey); req.body = body; const httpClient = new ServiceClient(); diff --git a/packages/core.gbapp/services/GBConfigService.ts b/packages/core.gbapp/services/GBConfigService.ts index 65875d85..3c539d4e 100644 --- a/packages/core.gbapp/services/GBConfigService.ts +++ b/packages/core.gbapp/services/GBConfigService.ts @@ -42,7 +42,6 @@ import { GBLog } from 'botlib'; * Base configuration for the server like storage. */ export class GBConfigService { - public static getServerPort(): number { if (process.env.port !== undefined) { return Number(process.env.port); @@ -71,7 +70,7 @@ export class GBConfigService { public static get(key: string): string | undefined { let value = GBConfigService.tryGet(key); - if (value !== undefined) { + if (value === undefined) { switch (key) { case 'CLOUD_USERNAME': value = undefined; @@ -130,9 +129,9 @@ export class GBConfigService { return value; } - public static tryGet(key: string) { + public static tryGet(key: string): any { let value = process.env[`container:${key}`]; - if (value !== undefined) { + if (value === undefined) { value = process.env[key]; } diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index 07a7fd94..71e18769 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -246,7 +246,7 @@ STORAGE_SYNC=true return await ngrok.connect({ port: port }); } else { - GBLog.warn('ngrok executable not found. Check installation or node_modules folder.'); + GBLog.warn('ngrok executable not found (only tested on Windows). Check installation or node_modules folder.'); return 'localhost'; } @@ -294,19 +294,23 @@ STORAGE_SYNC=true ); } } catch (error) { - // Check if storage is empty and needs formatting. - const isInvalidObject = error.parent.number === 208 || error.parent.errno === 1; // MSSQL or SQLITE. - if (isInvalidObject) { - if (GBConfigService.get('STORAGE_SYNC') !== 'true') { - throw new Error( - `Operating storage is out of sync or there is a storage connection error. - Try setting STORAGE_SYNC to true in .env file. Error: ${error.message}.` - ); - } else { - GBLog.info(`Storage is empty. After collecting storage structure from all .gbapps it will get synced.`); - } - } else { + if (error.parent === undefined) { throw new Error(`Cannot connect to operating storage: ${error.message}.`); + } else { + // Check if storage is empty and needs formatting. + const isInvalidObject = error.parent.number === 208 || error.parent.errno === 1; // MSSQL or SQLITE. + if (isInvalidObject) { + if (GBConfigService.get('STORAGE_SYNC') !== 'true') { + throw new Error( + `Operating storage is out of sync or there is a storage connection error. + Try setting STORAGE_SYNC to true in .env file. Error: ${error.message}.` + ); + } else { + GBLog.info(`Storage is empty. After collecting storage structure from all .gbapps it will get synced.`); + } + } else { + throw new Error(`Cannot connect to operating storage: ${error.message}.`); + } } } @@ -429,7 +433,7 @@ STORAGE_SYNC=true const fkcols = args[0]; let fkname = table; let matches2 = re4.exec(fkcols); - while (matches2 !== undefined) { + while (matches2 !== null) { fkname += `_${matches2[1]}`; matches2 = re4.exec(fkcols); } @@ -464,7 +468,7 @@ STORAGE_SYNC=true const fkcols = args[2]; let fkname = table; let matches2 = re3.exec(fkcols); - while (matches2 !== undefined) { + while (matches2 !== null) { fkname += `_${matches2[1]}`; matches2 = re3.exec(fkcols); } @@ -484,8 +488,7 @@ STORAGE_SYNC=true */ private async openStorageFrontier(installationDeployer: IGBInstallationDeployer) { const group = GBConfigService.get('CLOUD_GROUP'); - const serverName = GBConfigService.get('STORAGE_SERVER') - .split('.database.windows.net')[0]; + const serverName = GBConfigService.get('STORAGE_SERVER').split('.database.windows.net')[0]; await installationDeployer.openStorageFirewall(group, serverName); } } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index f954e338..f9d951a6 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -91,9 +91,9 @@ export class GBDeployer { if (additionalPath !== undefined) { paths = paths.concat(additionalPath.toLowerCase().split(';')); } - const botPackages: string[] = undefined; - const gbappPackages: string[] = undefined; - let generalPackages: string[]; + const botPackages: string[] = []; + const gbappPackages: string[] = []; + let generalPackages: string[] = []; function doIt(path) { const isDirectory = source => Fs.lstatSync(source).isDirectory(); diff --git a/packages/core.gbapp/services/GBImporterService.ts b/packages/core.gbapp/services/GBImporterService.ts index 187d9c5b..759757b1 100644 --- a/packages/core.gbapp/services/GBImporterService.ts +++ b/packages/core.gbapp/services/GBImporterService.ts @@ -53,7 +53,7 @@ export class GBImporter { public async importIfNotExistsBotPackage(botId: string, packageName: string, localPath: string) { const packageJson = JSON.parse(fs.readFileSync(urlJoin(localPath, 'package.json'), 'utf8')); - if (botId !== undefined) { + if (botId === undefined) { botId = packageJson.botId; } const instance = await this.core.loadInstance(botId); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 73f31f34..12bdf715 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -200,10 +200,10 @@ export class GBMinService { GBLog.error(msg); res.send(msg); } else { - await this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); - await this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); - await this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); - await this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', undefined); + this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); + this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); + this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); + this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', undefined); res.redirect(min.instance.botEndpoint); } } @@ -346,7 +346,7 @@ export class GBMinService { } private invokeLoadBot(appPackages: any[], min: GBMinInstance, server: any) { - const sysPackages : IGBPackage[] = undefined; + const sysPackages : IGBPackage[] = []; // NOTE: A semicolon is necessary before this line. [ GBCorePackage, diff --git a/src/app.ts b/src/app.ts index d87c942d..a22c8c0f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -50,7 +50,7 @@ import { GBDeployer } from '../packages/core.gbapp/services/GBDeployer'; import { GBImporter } from '../packages/core.gbapp/services/GBImporterService'; import { GBMinService } from '../packages/core.gbapp/services/GBMinService'; -const appPackages: IGBPackage[] = undefined; +const appPackages: IGBPackage[] = []; /** * General Bots open-core entry point. @@ -64,16 +64,13 @@ export class GBServer { GBLog.info(`The Bot Server is in STARTING mode...`); // Creates a basic HTTP server that will serve several URL, one for each - // bot instance. This allows the same server to attend multiple Bot on - // the Marketplace until GB get serverless. + // bot instance. const port = GBConfigService.getServerPort(); const server = express(); - - server.use(bodyParser.json()); // to support JSON-encoded bodies + server.use(bodyParser.json()); server.use( bodyParser.urlencoded({ - // to support URL-encoded bodies extended: true }) ); @@ -105,6 +102,7 @@ export class GBServer { try { await core.initStorage(); } catch (error) { + GBLog.verbose(`Error initializing storage: ${error}`); bootInstance = await core.createBootInstance(core, azureDeployer, proxyAddress); await core.initStorage(); } @@ -126,7 +124,11 @@ export class GBServer { 'boot.gbot', 'packages/boot.gbot' ); - const fullInstance = { ...packageInstance, ...bootInstance }; + if (bootInstance === undefined) { + bootInstance = packageInstance; + } + // tslint:disable-next-line:prefer-object-spread + const fullInstance = Object.assign(packageInstance, bootInstance); await core.saveInstance(fullInstance); let instances: IGBInstance[] = await core.loadAllInstances(core, azureDeployer, proxyAddress); instances = await core.ensureInstances(instances, bootInstance, core); From 440a3a990d44796679b7d467e7555bddd60b1bb8 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Wed, 27 Mar 2019 14:08:22 -0300 Subject: [PATCH 25/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49a8ba3b..7b437d42 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ editor). BASIC can be used to build custom dialogs so Bot can be extended just l ## Guide -[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/blob/master/book/chapter-01-index.md). +[Read the General Bots Guide](https://github.com/GeneralBots/BotBook/tree/master/book). ## Contributing From 895be687cfa549d52439444dc5417adf8c8739de Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 1 Apr 2019 09:01:07 -0300 Subject: [PATCH 26/32] fix(general): tslint being applied in all sources. --- .../dialogs/StartDialog.ts | 20 +++++++++---------- .../services/AzureDeployerService.ts | 4 ++-- packages/core.gbapp/services/GBDeployer.ts | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts index 8912dabf..ad28b267 100644 --- a/packages/azuredeployer.gbapp/dialogs/StartDialog.ts +++ b/packages/azuredeployer.gbapp/dialogs/StartDialog.ts @@ -120,7 +120,7 @@ export class StartDialog { private static retrieveUsername() { let value = GBConfigService.get('CLOUD_USERNAME'); - if (value !== undefined) { + if (value === undefined) { process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_USERNAME:`); value = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -130,7 +130,7 @@ export class StartDialog { private static retrievePassword() { let password = GBConfigService.get('CLOUD_PASSWORD'); - if (password !== undefined) { + if (password === undefined) { process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`); password = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -140,7 +140,7 @@ export class StartDialog { private static retrieveBotId() { let botId = GBConfigService.get('BOT_ID'); - if (botId !== undefined) { + if (botId === undefined) { process.stdout.write( `${GBAdminService.GB_PROMPT}Choose a unique bot Id containing lowercase letters, digits or dashes (cannot use dash as the first two or last one characters), @@ -155,7 +155,7 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac private static retrieveAuthoringKey() { let authoringKey = GBConfigService.get('NLP_AUTHORING_KEY'); - if (authoringKey !== undefined) { + if (authoringKey === undefined) { process.stdout.write( `${ GBAdminService.GB_PROMPT @@ -174,12 +174,12 @@ cannot start or end with or contain consecutive dashes and having 4 to 42 charac private static retrieveAppId() { let appId = GBConfigService.get('MARKETPLACE_ID'); - process.stdout.write( - `Sorry, this part cannot be automated yet due to Microsoft schedule, + if (appId === undefined) { + process.stdout.write( + `Sorry, this part cannot be automated yet due to Microsoft schedule, please go to https://apps.dev.microsoft.com/portal/register-app to generate manually an App ID and App Secret.\n` - ); - if (appId !== undefined) { + ); process.stdout.write('Generated Application Id (MARKETPLACE_ID):'); appId = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -189,7 +189,7 @@ generate manually an App ID and App Secret.\n` private static retrieveAppPassword() { let appPassword = GBConfigService.get('MARKETPLACE_SECRET'); - if (appPassword !== undefined) { + if (appPassword === undefined) { process.stdout.write('Generated Password (MARKETPLACE_SECRET):'); appPassword = scanf('%s').replace(/(\n|\r)+$/, ''); } @@ -217,7 +217,7 @@ generate manually an App ID and App Secret.\n` private static retrieveLocation() { let location = GBConfigService.get('CLOUD_LOCATION'); - if (location !== undefined) { + if (location === undefined) { process.stdout.write('CLOUD_LOCATION (eg. westus):'); location = scanf('%s'); } diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 2f0dc36b..58343667 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -477,7 +477,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { this.apiVersion }`; url = urlJoin(baseUrl, query); - req = AzureDeployerService.createRequestObject(url, accessToken, 'GET', JSON.stringify(parameters)); + req = AzureDeployerService.createRequestObject(url, accessToken, 'POST', JSON.stringify(parameters)); const resChannel = await httpClient.sendRequest(req); const key = JSON.parse(resChannel.bodyAsText).properties.properties.sites[0].key; instance.webchatKey = key; @@ -485,7 +485,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { } catch (error) { reject(error); } - }, 20000); + }, 20000); }); } diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index f9d951a6..d3333147 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -88,7 +88,7 @@ export class GBDeployer { let totalPackages = 0; const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); let paths = [GBDeployer.deployFolder]; - if (additionalPath !== undefined) { + if (additionalPath !== undefined && additionalPath !== '') { paths = paths.concat(additionalPath.toLowerCase().split(';')); } const botPackages: string[] = []; From 4b49686a3b5d8edff12532390a1eb0d3dbd5bec4 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 1 Apr 2019 15:47:18 -0300 Subject: [PATCH 27/32] fix(general): tslint being applied in all sources. --- package-lock.json | 213 ++-------------------------------------------- package.json | 2 +- 2 files changed, 6 insertions(+), 209 deletions(-) diff --git a/package-lock.json b/package-lock.json index 16825fcd..09eb8e72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3210,9 +3210,9 @@ "integrity": "sha512-++y/EOu52rRz+TWNkFbOu3Dj7fVyXRlrJktMFo6npr2ISnNNntWY5U0U3ouAUDt7aDKRsB1Rcn2LISdS5FRCoA==" }, "botlib": { - "version": "0.1.21", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.21.tgz", - "integrity": "sha512-AF8Sp+SF3xN/jzOCo7tnqJfGaYkeHP0mJKcfYL0iHYbUuIVsCVtNmIottd1WTzDfKhls+ZoqclSAbzzoC0LS+Q==", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.23.tgz", + "integrity": "sha512-hYDLME5hDuPJcPJ7wUU8rDjZ9WX8yfkDwEwaO8QbVxlKttygZuxs0Yu1dFBdNxjg7fdrqmZF560Z3DliyhkVhg==", "requires": { "async": "2.6.2", "botbuilder": "4.1.7", @@ -3222,181 +3222,17 @@ "botbuilder-dialogs": "4.2.0", "botbuilder-prompts": "4.0.0-preview1.2", "chrono-node": "1.3.11", - "dotenv-extended": "2.3.0", + "dotenv-extended": "2.4.0", "iconv-lite": "0.4.24", "ms": "2.1.1", "pragmatismo-io-framework": "1.0.19", "reflect-metadata": "0.1.13", - "sequelize": "4.42.1", + "sequelize": "4.43.0", "sequelize-typescript": "0.6.7", "wait-until": "0.0.2", "winston": "3.2.1" }, "dependencies": { - "@microsoft/recognizers-text-choice": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-choice/-/recognizers-text-choice-1.1.2.tgz", - "integrity": "sha512-4hFdqxusM0YrOXYM2RVYPl2rLjItSh6VkRiACjWB95GKC/DBGjJRYQpTxhzuZAsJSkDMinu/aLf8DvQtwUaLtA==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "grapheme-splitter": "^1.0.2" - } - }, - "@microsoft/recognizers-text-number": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.2.tgz", - "integrity": "sha512-GESjSF42dllym83diyd6pmlzFwdzidewoq/qSQz89lSoTx9HdJQHjbXxwdBp7w4Ax/Jroo2lcAedM3B7alZhYQ==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "bignumber.js": "^7.2.1", - "lodash.escaperegexp": "^4.1.2", - "lodash.sortby": "^4.7.0", - "lodash.trimend": "^4.5.1" - } - }, - "@microsoft/recognizers-text-suite": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-suite/-/recognizers-text-suite-1.1.2.tgz", - "integrity": "sha512-w3WCsKa//64jE1fGPFlV02rRg9+b3oDp+K5/skPAn4KDr80LjXxD1ulIgiJ2Ll/2OoBl8ociCiCjYA7zS3LpdQ==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "@microsoft/recognizers-text-choice": "~1.1.2", - "@microsoft/recognizers-text-date-time": "~1.1.2", - "@microsoft/recognizers-text-number": "~1.1.2", - "@microsoft/recognizers-text-number-with-unit": "~1.1.2", - "@microsoft/recognizers-text-sequence": "~1.1.2" - } - }, - "@types/node": { - "version": "9.6.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", - "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" - }, - "botbuilder": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", - "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", - "async-file": "^2.0.2", - "botbuilder-core": "^4.1.7", - "botframework-connector": "^4.1.7", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" - } - }, - "botbuilder-ai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", - "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", - "requires": { - "@microsoft/recognizers-text-date-time": "1.1.2", - "@types/html-entities": "^1.2.16", - "@types/node": "^9.3.0", - "@types/request-promise-native": "^1.0.10", - "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "^4.2.0", - "html-entities": "^1.2.1", - "moment": "^2.20.1", - "ms-rest": "^2.3.6", - "mstranslator": "^3.0.0", - "request": "^2.87.0", - "request-promise-native": "1.0.5" - }, - "dependencies": { - "botbuilder": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", - "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^10.12.18", - "async-file": "^2.0.2", - "botbuilder-core": "^4.3.2", - "botframework-connector": "^4.3.2", - "filenamify": "^2.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.12.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", - "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" - } - } - } - } - }, - "botbuilder-azure": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", - "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", - "requires": { - "@types/node": "^9.3.0", - "azure-storage": "^2.10.2", - "botbuilder": "^4.2.0", - "documentdb": "1.14.5", - "flat": "^4.0.0", - "semaphore": "^1.1.0" - }, - "dependencies": { - "botbuilder": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", - "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^10.12.18", - "async-file": "^2.0.2", - "botbuilder-core": "^4.3.2", - "botframework-connector": "^4.3.2", - "filenamify": "^2.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.12.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", - "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" - } - } - } - } - }, - "botbuilder-dialogs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", - "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", - "requires": { - "@microsoft/recognizers-text-choice": "1.1.2", - "@microsoft/recognizers-text-date-time": "1.1.2", - "@microsoft/recognizers-text-number": "1.1.2", - "@microsoft/recognizers-text-suite": "1.1.2", - "@types/node": "^9.3.0", - "botbuilder-core": "^4.2.0" - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "dotenv-extended": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/dotenv-extended/-/dotenv-extended-2.3.0.tgz", - "integrity": "sha512-QrFPzMr25tkdEesy2vJQDk0Yqs1Wy0IWSngaU/QNnQfukG735kXp3K+YfW6CMcR/N/3BGw5oIqyBLtGU8a5SZQ==", - "requires": { - "@types/dotenv": "^4.0.0", - "auto-parse": "^1.3.0", - "camelcase": "5.0.0", - "cross-spawn": "6.0.5", - "dotenv": "6.0.0", - "is-windows": "^1.0.0", - "lodash": "^4.17.10" - } - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3404,45 +3240,6 @@ "requires": { "safer-buffer": ">= 2.1.2 < 3" } - }, - "request-promise-native": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", - "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", - "requires": { - "request-promise-core": "1.1.1", - "stealthy-require": "^1.1.0", - "tough-cookie": ">=2.3.3" - } - }, - "sequelize": { - "version": "4.42.1", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.42.1.tgz", - "integrity": "sha512-W9i/CkBjCHLzEkJQkaxXaK82MA16b7F74PjtE7EUR+d7WU/X3U+YU5givWR+/VRXay1VXDyBOfXgw9/zdhDSDg==", - "requires": { - "bluebird": "^3.5.0", - "cls-bluebird": "^2.1.0", - "debug": "^3.1.0", - "depd": "^1.1.0", - "dottie": "^2.0.0", - "generic-pool": "3.5.0", - "inflection": "1.12.0", - "lodash": "^4.17.1", - "moment": "^2.20.0", - "moment-timezone": "^0.5.14", - "retry-as-promised": "^2.3.2", - "semver": "^5.5.0", - "terraformer-wkt-parser": "^1.1.2", - "toposort-class": "^1.0.1", - "uuid": "^3.2.1", - "validator": "^10.4.0", - "wkx": "^0.4.1" - } - }, - "validator": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", - "integrity": "sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==" } } }, diff --git a/package.json b/package.json index 3961eea5..466612a1 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "botbuilder-choices": "4.0.0-preview1.2", "botbuilder-dialogs": "4.2.0", "botbuilder-prompts": "4.0.0-preview1.2", - "botlib": "^0.1.21", + "botlib": "^0.1.23", "chai": "4.2.0", "child_process": "^1.0.2", "chokidar": "2.1.2", From 25d14592b7fc819a9f05f4ecd7c31dc547e06553 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 1 Apr 2019 16:15:11 -0300 Subject: [PATCH 28/32] fix(general): tslint being applied in all sources. --- packages/core.gbapp/services/GBImporterService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core.gbapp/services/GBImporterService.ts b/packages/core.gbapp/services/GBImporterService.ts index 759757b1..3f6ecc6b 100644 --- a/packages/core.gbapp/services/GBImporterService.ts +++ b/packages/core.gbapp/services/GBImporterService.ts @@ -57,7 +57,7 @@ export class GBImporter { botId = packageJson.botId; } const instance = await this.core.loadInstance(botId); - if (instance !== undefined) { + if (instance !== null) { return instance; } else { return await this.createInstanceInternal(botId, localPath, packageJson); From 77ccc3d319095423c775d9c8624ae7c8658818ec Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 7 Apr 2019 12:23:27 -0300 Subject: [PATCH 29/32] fix(general): tslint being applied in all sources. --- package-lock.json | 669 ++++++++++++------ package.json | 38 +- packages/admin.gbapp/dialogs/AdminDialog.ts | 2 +- packages/analytics.gblib/models/index.ts | 6 - .../services/AzureDeployerService.ts | 11 +- packages/core.gbapp/services/GBCoreService.ts | 15 +- packages/core.gbapp/services/GBMinService.ts | 6 +- packages/kb.gbapp/services/KBService.ts | 22 +- packages/security.gblib/models/index.ts | 15 +- 9 files changed, 498 insertions(+), 286 deletions(-) diff --git a/package-lock.json b/package-lock.json index 09eb8e72..3724beea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1693,9 +1693,9 @@ } }, "@types/sequelize": { - "version": "4.27.39", - "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.39.tgz", - "integrity": "sha512-FABh5gLbXgh6/0pmJQ7VzjN5KAxd/IbX3G5Z6fSBZ6DSqaYl7DBP22nGtLh2e6dPmC0rUxfJclNhzQcC3XgvVw==", + "version": "4.27.46", + "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.46.tgz", + "integrity": "sha512-hqosowwLJsLrR+A8IOVgGQaToaBAZE54WLJmjxARaoHC4hl4lmfzXPNY/JGn3hmxNIhb6klHs7skQ2uJPrlXSA==", "dev": true, "requires": { "@types/bluebird": "*", @@ -1733,9 +1733,9 @@ } }, "@types/validator": { - "version": "10.9.0", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-10.9.0.tgz", - "integrity": "sha512-mf0VpXk+NoTmkUmuJCsdwBYxjYZW41amCSzd4t/fABMKl+qGMViwFP0pR7ukFdZRXWI1LIkca3VIbXVBmWZ4kQ==" + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-10.11.0.tgz", + "integrity": "sha512-i1aY7RKb6HmQIEnK0cBmUZUp1URx0riIHw/GYNoZ46Su0GWfLiDmMI8zMRmaauMnOTg2bQag0qfwcyUFC9Tn+A==" }, "@types/winston": { "version": "2.4.4", @@ -2013,6 +2013,11 @@ } } }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -2198,9 +2203,9 @@ } }, "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.2.tgz", + "integrity": "sha512-6xrbvN0MOBKSJDdonmSSz2OwFSgxRaVtBDes26mj9KIGtDo+g9xosFRSC+i1gQh2oAN/tQ62AI/pGZGQjVOiRg==" }, "async-file": { "version": "2.0.2", @@ -2303,9 +2308,9 @@ } }, "azure-cognitiveservices-luis-runtime": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/azure-cognitiveservices-luis-runtime/-/azure-cognitiveservices-luis-runtime-1.2.0.tgz", - "integrity": "sha512-8A71ZfDs5uB+t7SX7GdESuAxgAOR+jKmhnRprx09Pk5gfdJd1HSC2moLxUhqJsS1WQ6I+g7ShG7kLXWmQIXQyg==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/azure-cognitiveservices-luis-runtime/-/azure-cognitiveservices-luis-runtime-1.2.2.tgz", + "integrity": "sha512-qds2UQ85IWMj9w3HXB0BS0MqSyQ50YlVtS6Y1X6aSf2sN1RVvdct6gZnUMREgjDTKgo+/Iwh4MmPVmhvpPUu0A==", "requires": { "ms-rest": "^2.5.0" }, @@ -2568,9 +2573,9 @@ "dev": true }, "big-integer": { - "version": "1.6.42", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.42.tgz", - "integrity": "sha512-3UQFKcRMx+5Z+IK5vYTMYK2jzLRJkt+XqyDdacgWgtMjjuifKpKTFneJLEgeBElOE2/lXZ1LcMcb5s8pwG2U8Q==" + "version": "1.6.43", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.43.tgz", + "integrity": "sha512-9dULc9jsKmXl0Aeunug8wbF+58n+hQoFjqClN7WeZwGLh0XJUWyJJ9Ee+Ep+Ql/J9fRsTVaeThp8MhiCCrY0Jg==" }, "big-number": { "version": "1.0.0", @@ -2598,9 +2603,9 @@ } }, "binary-extensions": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", - "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==" + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==" }, "binary-search-bounds": { "version": "2.0.3", @@ -2617,9 +2622,9 @@ } }, "bluebird": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", - "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==" + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.4.tgz", + "integrity": "sha512-FG+nFEZChJrbQ9tIccIfZJBz3J7mLrAhxakAbnrJWn8d7aKOC+LWifa0G+p4ZqKp4y13T7juYvdhq9NzKdsrjw==" }, "body-parser": { "version": "1.18.3", @@ -2647,68 +2652,62 @@ } }, "botbuilder": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", - "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.4.tgz", + "integrity": "sha512-7EizagbDXGKCwHlQi0ICp1UpjBXxlha2c67y1XxaXzORWJyCTmd8HNP2iFdnxsZUGluh90jgN4C1hmJLBzSCUw==", "requires": { "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", + "@types/node": "^10.12.18", "async-file": "^2.0.2", - "botbuilder-core": "^4.1.7", - "botframework-connector": "^4.1.7", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" + "botbuilder-core": "^4.3.4", + "botframework-connector": "^4.3.4", + "filenamify": "^2.0.0" }, "dependencies": { "@types/node": { - "version": "9.6.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", - "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" } } }, "botbuilder-ai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", - "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.3.4.tgz", + "integrity": "sha512-yc8QNCD6vT3VWOh80bbdkfWivLuRz/yYxchsPNldlRPa9N/m9smmBaEa9ufnr0Eevmxic4Bh0kLlU6LVWqRULw==", "requires": { "@microsoft/recognizers-text-date-time": "1.1.2", "@types/html-entities": "^1.2.16", - "@types/node": "^9.3.0", + "@types/node": "^10.12.18", "@types/request-promise-native": "^1.0.10", - "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "^4.2.0", + "azure-cognitiveservices-luis-runtime": "1.2.2", + "botbuilder-core": "^4.3.4", "html-entities": "^1.2.1", "moment": "^2.20.1", - "ms-rest": "^2.3.6", - "mstranslator": "^3.0.0", + "ms-rest": "2.5.0", "request": "^2.87.0", - "request-promise-native": "1.0.5" + "request-promise-native": "1.0.5", + "url-parse": "^1.4.4" }, "dependencies": { "@types/node": { - "version": "9.6.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", - "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" }, - "botbuilder": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", - "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", + "ms-rest": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.5.0.tgz", + "integrity": "sha512-QUTg9CsmWpofDO0MR37z8B28/T9ObpQ+FM23GGDMKXw8KYDJ3cEBdK6dJTDDrtSoZG3U+S/vdmSEwJ7FNj6Kog==", "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^10.12.18", - "async-file": "^2.0.2", - "botbuilder-core": "^4.3.2", - "botframework-connector": "^4.3.2", - "filenamify": "^2.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.12.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", - "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" - } + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.88.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" } }, "request-promise-native": { @@ -2724,42 +2723,22 @@ } }, "botbuilder-azure": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", - "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.3.4.tgz", + "integrity": "sha512-M9PVc7kiASAXeJynMyNuj1rXnQOKv3pXY7AWr9ERPatJrjAtSHbMQAZnNAB5nkENIuDiHFk6rAq0S5SmQ+e6xw==", "requires": { - "@types/node": "^9.3.0", - "azure-storage": "^2.10.2", - "botbuilder": "^4.2.0", + "@types/node": "^10.12.18", + "azure-storage": "2.10.2", + "botbuilder": "^4.3.4", "documentdb": "1.14.5", "flat": "^4.0.0", "semaphore": "^1.1.0" }, "dependencies": { "@types/node": { - "version": "9.6.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", - "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" - }, - "botbuilder": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.2.tgz", - "integrity": "sha512-l7Y83WxytYSBcsFCSoqc8RqXhctnApV131nn72K/mA627DQWAK+M63gYqTFYJBjsO8ok9mNHEzPWQSE9TaJ03Q==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^10.12.18", - "async-file": "^2.0.2", - "botbuilder-core": "^4.3.2", - "botframework-connector": "^4.3.2", - "filenamify": "^2.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.12.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", - "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" - } - } + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" } } }, @@ -2830,7 +2809,7 @@ "@types/node-fetch": "^1.6.7", "@types/uuid": "^3.4.3", "fetch-cookie": "^0.7.0", - "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#master", + "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db", "form-data": "^2.3.2", "is-buffer": "^2.0.0", "is-stream": "^1.1.0", @@ -2908,12 +2887,12 @@ } }, "botbuilder-core": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.3.2.tgz", - "integrity": "sha512-iKaSjOffhb4b40B3N/k1vjFq0AD5QBtx9/Tg8GdeXgxWtbY0QXiFekU7pKfPBAOS3MhY8h/u7w8SmOnrENk62w==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder-core/-/botbuilder-core-4.3.4.tgz", + "integrity": "sha512-azpPzGns88F3QIBMZw9UOn/DS/xo1odcbZq2GQkKXXQ4DxsE0xDmYUCW4rt/PuFbmB7c+GlQ8GyQZPFBI1xOHA==", "requires": { "assert": "^1.4.1", - "botframework-schema": "^4.3.2" + "botframework-schema": "^4.3.4" } }, "botbuilder-core-extensions": { @@ -2955,16 +2934,16 @@ } }, "botbuilder-dialogs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", - "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.3.4.tgz", + "integrity": "sha512-cHdYo8GrQrwl8ZvjAyH+Qtrde9cNJ+/61KzFeUCBRJ4d6ZQ5OUkpAKZ/u8fbmaQe2zL4chR4dgxjpxaKtMRshg==", "requires": { "@microsoft/recognizers-text-choice": "1.1.2", "@microsoft/recognizers-text-date-time": "1.1.2", "@microsoft/recognizers-text-number": "1.1.2", "@microsoft/recognizers-text-suite": "1.1.2", - "@types/node": "^9.3.0", - "botbuilder-core": "^4.2.0" + "@types/node": "^10.12.18", + "botbuilder-core": "^4.3.4" }, "dependencies": { "@microsoft/recognizers-text-choice": { @@ -3002,9 +2981,9 @@ } }, "@types/node": { - "version": "9.6.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.45.tgz", - "integrity": "sha512-9scD7xI1kpIoMs3gVFMOWsWDyRIQ1AOZwe56i1CQPE6N/P4POYkn9UtW5F66t8C2AIoPtVfOFycQ2r11t3pcyg==" + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" } } }, @@ -3075,7 +3054,7 @@ "@types/node-fetch": "^1.6.7", "@types/uuid": "^3.4.3", "fetch-cookie": "^0.7.0", - "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#master", + "fetch-ponyfill": "github:amarzavery/fetch-ponyfill#136e6f8192bdb2aa0b7983f0b3b4361c357be9db", "form-data": "^2.3.2", "is-buffer": "^2.0.0", "is-stream": "^1.1.0", @@ -3153,15 +3132,15 @@ } }, "botframework-connector": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.3.2.tgz", - "integrity": "sha512-nwAAULKFMV2uvXf123R2MRcq3slNMYypBLdoa6KMt6Ri+S2FqVIC4vn+y+pIfFDYbOPOkXErh/JlbunOcfTteA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botframework-connector/-/botframework-connector-4.3.4.tgz", + "integrity": "sha512-aaUHVcgX1m1uwBNxdD5UrNo1f5t7zHDM/h6ha8wJMBqzwc7KXklTwagZccsw18NA1v5g5hVB8S2WgVXCeumXLg==", "requires": { "@azure/ms-rest-js": "1.2.6", "@types/jsonwebtoken": "7.2.8", "@types/node": "^10.12.18", "base64url": "^3.0.0", - "botframework-schema": "^4.3.2", + "botframework-schema": "^4.3.4", "form-data": "^2.3.3", "jsonwebtoken": "8.0.1", "nock": "^10.0.3", @@ -3178,9 +3157,9 @@ } }, "@types/node": { - "version": "10.12.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.30.tgz", - "integrity": "sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==" + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" }, "base64url": { "version": "3.0.1", @@ -3205,9 +3184,9 @@ } }, "botframework-schema": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.3.2.tgz", - "integrity": "sha512-++y/EOu52rRz+TWNkFbOu3Dj7fVyXRlrJktMFo6npr2ISnNNntWY5U0U3ouAUDt7aDKRsB1Rcn2LISdS5FRCoA==" + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botframework-schema/-/botframework-schema-4.3.4.tgz", + "integrity": "sha512-8t+pyoMC1zN0w223SLh+qFe19ILYxcC12VPRRPXS8dydFqnCf8nV+SOpXoVFsx0eaKIhWXe868olz+Ms3ihTkA==" }, "botlib": { "version": "0.1.23", @@ -3233,6 +3212,167 @@ "winston": "3.2.1" }, "dependencies": { + "@microsoft/recognizers-text-choice": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-choice/-/recognizers-text-choice-1.1.2.tgz", + "integrity": "sha512-4hFdqxusM0YrOXYM2RVYPl2rLjItSh6VkRiACjWB95GKC/DBGjJRYQpTxhzuZAsJSkDMinu/aLf8DvQtwUaLtA==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "grapheme-splitter": "^1.0.2" + } + }, + "@microsoft/recognizers-text-number": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.2.tgz", + "integrity": "sha512-GESjSF42dllym83diyd6pmlzFwdzidewoq/qSQz89lSoTx9HdJQHjbXxwdBp7w4Ax/Jroo2lcAedM3B7alZhYQ==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "bignumber.js": "^7.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.sortby": "^4.7.0", + "lodash.trimend": "^4.5.1" + } + }, + "@microsoft/recognizers-text-suite": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-suite/-/recognizers-text-suite-1.1.2.tgz", + "integrity": "sha512-w3WCsKa//64jE1fGPFlV02rRg9+b3oDp+K5/skPAn4KDr80LjXxD1ulIgiJ2Ll/2OoBl8ociCiCjYA7zS3LpdQ==", + "requires": { + "@microsoft/recognizers-text": "~1.1.2", + "@microsoft/recognizers-text-choice": "~1.1.2", + "@microsoft/recognizers-text-date-time": "~1.1.2", + "@microsoft/recognizers-text-number": "~1.1.2", + "@microsoft/recognizers-text-number-with-unit": "~1.1.2", + "@microsoft/recognizers-text-sequence": "~1.1.2" + } + }, + "@types/node": { + "version": "9.6.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.47.tgz", + "integrity": "sha512-56wEJWXZs+3XXoTe/OCpdZ6czrONhy+6hT0GdPOb7HvudLTMJ1T5tuZPs37K5cPR5t+J9+vLPFDQgUQ8NWJE1w==" + }, + "@types/sequelize": { + "version": "4.27.24", + "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.24.tgz", + "integrity": "sha512-5uMFsMa/0hU/7/8znyfBKSJy2Mbd57uRpYk5X1+Phz9dN0MRZLbTbj1JMeB3CJ4R9b1coNQGfp2kXh4OjI9UyA==", + "requires": { + "@types/bluebird": "*", + "@types/continuation-local-storage": "*", + "@types/lodash": "*", + "@types/validator": "*" + } + }, + "botbuilder": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", + "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^9.3.0", + "async-file": "^2.0.2", + "botbuilder-core": "^4.1.7", + "botframework-connector": "^4.1.7", + "filenamify": "^2.0.0", + "rimraf": "^2.6.2" + } + }, + "botbuilder-ai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", + "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", + "requires": { + "@microsoft/recognizers-text-date-time": "1.1.2", + "@types/html-entities": "^1.2.16", + "@types/node": "^9.3.0", + "@types/request-promise-native": "^1.0.10", + "azure-cognitiveservices-luis-runtime": "^1.0.0", + "botbuilder": "^4.2.0", + "html-entities": "^1.2.1", + "moment": "^2.20.1", + "ms-rest": "^2.3.6", + "mstranslator": "^3.0.0", + "request": "^2.87.0", + "request-promise-native": "1.0.5" + }, + "dependencies": { + "botbuilder": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.4.tgz", + "integrity": "sha512-7EizagbDXGKCwHlQi0ICp1UpjBXxlha2c67y1XxaXzORWJyCTmd8HNP2iFdnxsZUGluh90jgN4C1hmJLBzSCUw==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^10.12.18", + "async-file": "^2.0.2", + "botbuilder-core": "^4.3.4", + "botframework-connector": "^4.3.4", + "filenamify": "^2.0.0" + }, + "dependencies": { + "@types/node": { + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" + } + } + } + } + }, + "botbuilder-azure": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", + "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", + "requires": { + "@types/node": "^9.3.0", + "azure-storage": "^2.10.2", + "botbuilder": "^4.2.0", + "documentdb": "1.14.5", + "flat": "^4.0.0", + "semaphore": "^1.1.0" + }, + "dependencies": { + "botbuilder": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.4.tgz", + "integrity": "sha512-7EizagbDXGKCwHlQi0ICp1UpjBXxlha2c67y1XxaXzORWJyCTmd8HNP2iFdnxsZUGluh90jgN4C1hmJLBzSCUw==", + "requires": { + "@types/filenamify": "^2.0.1", + "@types/node": "^10.12.18", + "async-file": "^2.0.2", + "botbuilder-core": "^4.3.4", + "botframework-connector": "^4.3.4", + "filenamify": "^2.0.0" + }, + "dependencies": { + "@types/node": { + "version": "10.14.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", + "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" + } + } + } + } + }, + "botbuilder-dialogs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", + "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", + "requires": { + "@microsoft/recognizers-text-choice": "1.1.2", + "@microsoft/recognizers-text-date-time": "1.1.2", + "@microsoft/recognizers-text-number": "1.1.2", + "@microsoft/recognizers-text-suite": "1.1.2", + "@types/node": "^9.3.0", + "botbuilder-core": "^4.2.0" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3240,6 +3380,64 @@ "requires": { "safer-buffer": ">= 2.1.2 < 3" } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" + } + }, + "sequelize": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.43.0.tgz", + "integrity": "sha512-GkwGFVREKBf/ql6W6RXwXy1fzb/HOk0lmOBbcQrJMvJtB65Jfg7CUh+sENh0deuWk5s79JedgZJ/yEjvtzHXaQ==", + "requires": { + "bluebird": "^3.5.0", + "cls-bluebird": "^2.1.0", + "debug": "^3.1.0", + "depd": "^1.1.0", + "dottie": "^2.0.0", + "generic-pool": "3.5.0", + "inflection": "1.12.0", + "lodash": "^4.17.1", + "moment": "^2.20.0", + "moment-timezone": "^0.5.14", + "retry-as-promised": "^2.3.2", + "semver": "^5.5.0", + "terraformer-wkt-parser": "^1.1.2", + "toposort-class": "^1.0.1", + "uuid": "^3.2.1", + "validator": "^10.4.0", + "wkx": "^0.4.1" + } + }, + "sequelize-typescript": { + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/sequelize-typescript/-/sequelize-typescript-0.6.7.tgz", + "integrity": "sha512-ae21Gq9VOVXlIjnh2vLdL42Kev6r4LC82xOQ2fXo0lHzQvjFeH8/GaWUlpvYv57AOgc+ZnElbYFbSLKdT9ue0w==", + "requires": { + "@types/bluebird": "3.5.18", + "@types/node": "6.0.41", + "@types/sequelize": "4.27.24", + "es6-shim": "0.35.3", + "glob": "7.1.2" + }, + "dependencies": { + "@types/node": { + "version": "6.0.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.41.tgz", + "integrity": "sha1-V4z1Oq7GWIe8rxZ5L4ciky6P+Oo=" + } + } + }, + "validator": { + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", + "integrity": "sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==" } } }, @@ -3684,9 +3882,9 @@ "integrity": "sha1-sffn/HPSXn/R1FWtyU4UODAYK1o=" }, "chokidar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.2.tgz", - "integrity": "sha512-IwXUx0FXc5ibYmPC2XeEj5mpXoV66sR+t3jqu2NS2GYwCktt3KF1/Qqjws/NkegajBA4RbZ5+DDwlOiJsxDHEg==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.5.tgz", + "integrity": "sha512-i0TprVWp+Kj4WRPtInjexJ8Q+BqTE909VpH8xVhXrJkoc5QC8VO9TryGOqTr+2hljzc1sC62t22h5tZePodM/A==", "requires": { "anymatch": "^2.0.0", "async-each": "^1.0.1", @@ -3699,7 +3897,7 @@ "normalize-path": "^3.0.0", "path-is-absolute": "^1.0.0", "readdirp": "^2.2.1", - "upath": "^1.1.0" + "upath": "^1.1.1" } }, "chownr": { @@ -4103,9 +4301,9 @@ } }, "commander": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==" }, "commitizen": { "version": "3.0.7", @@ -4611,9 +4809,9 @@ } }, "csv-parse": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.3.3.tgz", - "integrity": "sha512-bZ+AZjm2LlWEp5+TKeFeXDldduCUUaxEif+KUv+zvAwmCvCKTqeSHVEyxztGCQ6OE+87ObRq4NsCmg91SuJbhQ==" + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.3.4.tgz", + "integrity": "sha512-M1R4WL+vt81+GnkKzi0s1qQM6WXvHQKDecNkpozzAEG8LHvIW9bq5eBnOKFQn50fTuAos7JodBh/07MK+J6G2Q==" }, "csv-parser": { "version": "1.12.1", @@ -5372,9 +5570,9 @@ } }, "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" }, "yallist": { "version": "2.1.2", @@ -6457,8 +6655,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -6476,13 +6673,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6495,18 +6690,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6609,8 +6801,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6620,7 +6811,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6633,20 +6823,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6663,7 +6850,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6736,8 +6922,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -6747,7 +6932,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -6823,8 +7007,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -6854,7 +7037,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6872,7 +7054,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6911,13 +7092,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } }, @@ -8356,9 +8535,9 @@ "dev": true }, "js-beautify": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.9.0.tgz", - "integrity": "sha512-P0skmY4IDjfLiVrx+GLDeme8w5G0R1IGXgccVU5HP2VM3lRblH7qN2LTea5vZAxrDjpZBD0Jv+ahpjwVcbz/rw==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.9.1.tgz", + "integrity": "sha512-oxxvVZdOdUfzk8IOLBF2XUZvl2GoBEfA+b0of4u2EBY/46NlXasi8JdFvazA5lCrf9/lQhTjyVy2QCUW7iq0MQ==", "requires": { "config-chain": "^1.1.12", "editorconfig": "^0.15.2", @@ -9039,9 +9218,9 @@ } }, "marked": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.1.tgz", - "integrity": "sha512-+H0L3ibcWhAZE02SKMqmvYsErLo4EAVJxu5h3bHBBDvvjeWXtl92rGUSBYHL2++5Y+RSNgl8dYOAXcYe7lp1fA==" + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.2.tgz", + "integrity": "sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA==" }, "marked-terminal": { "version": "3.2.0", @@ -14164,9 +14343,9 @@ } }, "opn": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/opn/-/opn-5.4.0.tgz", - "integrity": "sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/opn/-/opn-6.0.0.tgz", + "integrity": "sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ==", "requires": { "is-wsl": "^1.1.0" } @@ -16031,37 +16210,58 @@ } }, "sequelize": { - "version": "4.43.0", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.43.0.tgz", - "integrity": "sha512-GkwGFVREKBf/ql6W6RXwXy1fzb/HOk0lmOBbcQrJMvJtB65Jfg7CUh+sENh0deuWk5s79JedgZJ/yEjvtzHXaQ==", + "version": "5.2.12", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-5.2.12.tgz", + "integrity": "sha512-Pgqri8SlWzd6gZCX0Zk0kTEnZlratF/W2l2A5zHtw4EMxL7jff+Jj8EazdTWqoh/1akCRn3iq2j/uMXcOBdhVQ==", "requires": { "bluebird": "^3.5.0", "cls-bluebird": "^2.1.0", - "debug": "^3.1.0", - "depd": "^1.1.0", + "debug": "^4.1.1", "dottie": "^2.0.0", - "generic-pool": "3.5.0", "inflection": "1.12.0", - "lodash": "^4.17.1", - "moment": "^2.20.0", - "moment-timezone": "^0.5.14", - "retry-as-promised": "^2.3.2", - "semver": "^5.5.0", - "terraformer-wkt-parser": "^1.1.2", + "lodash": "^4.17.11", + "moment": "^2.24.0", + "moment-timezone": "^0.5.21", + "retry-as-promised": "^3.1.0", + "semver": "^5.6.0", + "sequelize-pool": "^1.0.2", "toposort-class": "^1.0.1", "uuid": "^3.2.1", - "validator": "^10.4.0", - "wkx": "^0.4.1" + "validator": "^10.11.0", + "wkx": "^0.4.6" }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "requires": { "ms": "^2.1.1" } }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "moment": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + }, + "retry-as-promised": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-3.2.0.tgz", + "integrity": "sha512-CybGs60B7oYU/qSQ6kuaFmRd9sTZ6oXSc0toqePvV74Ac6/IFZSI1ReFQmtCN+uvW1Mtqdwpvt/LGOiCBAY2Mg==", + "requires": { + "any-promise": "^1.3.0" + } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + }, "validator": { "version": "10.11.0", "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", @@ -16069,27 +16269,40 @@ } } }, - "sequelize-typescript": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/sequelize-typescript/-/sequelize-typescript-0.6.7.tgz", - "integrity": "sha512-ae21Gq9VOVXlIjnh2vLdL42Kev6r4LC82xOQ2fXo0lHzQvjFeH8/GaWUlpvYv57AOgc+ZnElbYFbSLKdT9ue0w==", + "sequelize-pool": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-1.0.2.tgz", + "integrity": "sha512-VMKl/gCCdIvB1gFZ7p+oqLFEyZEz3oMMYjkKvfEC7GoO9bBcxmfOOU9RdkoltfXGgBZFigSChihRly2gKtsh2w==", "requires": { - "@types/bluebird": "3.5.18", - "@types/node": "6.0.41", - "@types/sequelize": "4.27.24", + "bluebird": "^3.5.3" + } + }, + "sequelize-typescript": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/sequelize-typescript/-/sequelize-typescript-0.6.9.tgz", + "integrity": "sha512-8A5gi8BpKx4Gk9BjD3Dxrv7Ps/7PpZuYfoVkQXNMuL9a4M2d2fKZiBLurSA/5KmNgdVrLKKRkyJxghBpFR7tNg==", + "requires": { + "@types/bluebird": "3.5.26", + "@types/node": "11.12.2", + "@types/sequelize": "4.27.46", "es6-shim": "0.35.3", "glob": "7.1.2" }, "dependencies": { + "@types/bluebird": { + "version": "3.5.26", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.26.tgz", + "integrity": "sha512-aj2mrBLn5ky0GmAg6IPXrQjnN0iB/ulozuJ+oZdrHRAzRbXjGmu4UXsNCjFvPbSaaPZmniocdOzsM392qLOlmQ==" + }, "@types/node": { - "version": "6.0.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.41.tgz", - "integrity": "sha1-V4z1Oq7GWIe8rxZ5L4ciky6P+Oo=" + "version": "11.12.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.12.2.tgz", + "integrity": "sha512-c82MtnqWB/CqqK7/zit74Ob8H1dBdV7bK+BcErwtXbe0+nUGkgzq5NTDmRW/pAv2lFtmeNmW95b0zK2hxpeklg==" }, "@types/sequelize": { - "version": "4.27.24", - "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.24.tgz", - "integrity": "sha512-5uMFsMa/0hU/7/8znyfBKSJy2Mbd57uRpYk5X1+Phz9dN0MRZLbTbj1JMeB3CJ4R9b1coNQGfp2kXh4OjI9UyA==", + "version": "4.27.46", + "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.46.tgz", + "integrity": "sha512-hqosowwLJsLrR+A8IOVgGQaToaBAZE54WLJmjxARaoHC4hl4lmfzXPNY/JGn3hmxNIhb6klHs7skQ2uJPrlXSA==", "requires": { "@types/bluebird": "*", "@types/continuation-local-storage": "*", @@ -16352,17 +16565,17 @@ } }, "simple-git": { - "version": "1.107.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-1.107.0.tgz", - "integrity": "sha512-t4OK1JRlp4ayKRfcW6owrWcRVLyHRUlhGd0uN6ZZTqfDq8a5XpcUdOKiGRNobHEuMtNqzp0vcJNvhYWwh5PsQA==", + "version": "1.110.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-1.110.0.tgz", + "integrity": "sha512-UYY0rQkknk0P5eb+KW+03F4TevZ9ou0H+LoGaj7iiVgpnZH4wdj/HTViy/1tNNkmIPcmtxuBqXWiYt2YwlRKOQ==", "requires": { "debug": "^4.0.1" }, "dependencies": { "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "requires": { "ms": "^2.1.1" } @@ -17171,19 +17384,19 @@ } }, "tedious": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/tedious/-/tedious-5.0.3.tgz", - "integrity": "sha512-GSGmm7+o+5Zzi2vSKIKkC+8J4uRc9wOR+DZ3LTecz8quTpA+5KAd2cmfbENxi7dTWTP3ARobpY3jchBqbbo4WQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/tedious/-/tedious-6.1.0.tgz", + "integrity": "sha512-ejIgokiYwyKwGzwqkcx5hdQ6faJOhwOZzStLMSC7E+mbetI5/Rl+JD1K7B/SlNH1Hz7WlGcZxMeRR7ioGpqWAw==", "requires": { "adal-node": "^0.1.22", "big-number": "1.0.0", - "bl": "^2.0.1", + "bl": "^2.2.0", "depd": "^1.1.2", "iconv-lite": "^0.4.23", "native-duplexpair": "^1.0.0", "punycode": "^2.1.0", - "readable-stream": "^3.0.3", - "sprintf-js": "^1.1.1" + "readable-stream": "^3.1.1", + "sprintf-js": "^1.1.2" }, "dependencies": { "punycode": { @@ -17192,9 +17405,9 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "readable-stream": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.1.tgz", - "integrity": "sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", + "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -17635,9 +17848,9 @@ "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=" }, "tslint": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.13.1.tgz", - "integrity": "sha512-fplQqb2miLbcPhyHoMV4FU9PtNRbgmm/zI5d3SZwwmJQM6V0eodju+hplpyfhLWpmwrDNfNYU57uYRb8s0zZoQ==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.15.0.tgz", + "integrity": "sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -17646,13 +17859,25 @@ "commander": "^2.12.1", "diff": "^3.2.0", "glob": "^7.1.1", - "js-yaml": "^3.7.0", + "js-yaml": "^3.13.0", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.27.2" + "tsutils": "^2.29.0" + }, + "dependencies": { + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + } } }, "tslint-microsoft-contrib": { @@ -17788,9 +18013,9 @@ } }, "typescript": { - "version": "3.3.3333", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3333.tgz", - "integrity": "sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==" + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.1.tgz", + "integrity": "sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q==" }, "typpy": { "version": "2.3.10", @@ -17982,9 +18207,9 @@ "dev": true }, "upath": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", - "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.2.tgz", + "integrity": "sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q==" }, "update-notifier": { "version": "2.3.0", diff --git a/package.json b/package.json index 466612a1..e2161e27 100644 --- a/package.json +++ b/package.json @@ -57,28 +57,28 @@ "azure-arm-search": "^1.3.0-preview", "azure-arm-sql": "5.6.0", "azure-arm-website": "5.7.0", - "bluebird": "^3.5.3", + "bluebird": "^3.5.4", "body-parser": "1.18.3", - "botbuilder": "4.1.7", - "botbuilder-ai": "4.2.0", - "botbuilder-azure": "4.2.0", + "botbuilder": "4.3.4", + "botbuilder-ai": "4.3.4", + "botbuilder-azure": "4.3.4", "botbuilder-choices": "4.0.0-preview1.2", - "botbuilder-dialogs": "4.2.0", + "botbuilder-dialogs": "4.3.4", "botbuilder-prompts": "4.0.0-preview1.2", - "botlib": "^0.1.23", + "botlib": "0.1.24", "chai": "4.2.0", "child_process": "^1.0.2", - "chokidar": "2.1.2", + "chokidar": "2.1.5", "cli-spinner": "^0.2.10", - "csv-parse": "4.3.3", + "csv-parse": "4.3.4", "dotenv-extended": "2.4.0", "express": "4.16.4", "express-promise-router": "3.0.3", "fs-extra": "7.0.1", "ip": "^1.1.5", - "js-beautify": "^1.9.0", + "js-beautify": "^1.9.1", "localize": "0.4.7", - "marked": "0.6.1", + "marked": "0.6.2", "mocha": "6.0.2", "mocha-typescript": "1.1.17", "ms": "2.1.1", @@ -87,28 +87,28 @@ "nexmo": "2.4.1", "ngrok": "3.1.1", "nyc": "13.3.0", - "opn": "5.4.0", - "pragmatismo-io-framework": "1.0.19", + "opn": "6.0.0", + "pragmatismo-io-framework": "1.0.20", "process-exists": "3.1.0", "public-ip": "^3.0.0", "reflect-metadata": "0.1.13", "request-promise": "4.2.4", "request-promise-native": "1.0.7", "scanf": "^1.0.2", - "sequelize": "^4.43.0", - "sequelize-typescript": "0.6.7", + "sequelize": "^5.2.12", + "sequelize-typescript": "0.6.9", "shx": "0.3.2", - "simple-git": "1.107.0", + "simple-git": "1.110.0", "sqlite3": "4.0.6", "strict-password-generator": "^1.1.2", "swagger-client": "3.8.25", - "tedious": "5.0.3", + "tedious": "6.1.0", "temperature-js": "^0.1.0", "ts-node": "8.0.3", "typedoc": "0.14.2", "typedoc-plugin-external-module-name": "^2.0.0", "typedoc-plugin-markdown": "^1.1.27", - "typescript": "3.3.3333", + "typescript": "3.4.1", "url-join": "4.0.0", "vbscript-to-typescript": "^1.0.8", "wait-until": "0.0.2", @@ -124,7 +124,7 @@ "@semantic-release/release-notes-generator": "^7.1.4", "@types/chai": "4.1.7", "@types/mocha": "5.2.6", - "@types/sequelize": "4.27.39", + "@types/sequelize": "4.27.46", "@types/url-join": "4.0.0", "@types/winston": "2.4.4", "ban-sensitive-files": "1.9.2", @@ -142,7 +142,7 @@ "standard": "12.0.1", "travis-deploy-once": "5.0.11", "ts-loader": "^5.3.3", - "tslint": "^5.13.1", + "tslint": "^5.15.0", "tslint-microsoft-contrib": "^6.1.0" }, "eslintConfig": { diff --git a/packages/admin.gbapp/dialogs/AdminDialog.ts b/packages/admin.gbapp/dialogs/AdminDialog.ts index eb27b4d4..828bc926 100644 --- a/packages/admin.gbapp/dialogs/AdminDialog.ts +++ b/packages/admin.gbapp/dialogs/AdminDialog.ts @@ -65,7 +65,7 @@ export class AdminDialog extends IGBDialog { if (!AdminDialog.isSharePointPath(packageName)) { const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH'); - if (additionalPath !== undefined) { + if (additionalPath === undefined) { throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.'); } await deployer.deployPackage(min, urlJoin(additionalPath, packageName)); diff --git a/packages/analytics.gblib/models/index.ts b/packages/analytics.gblib/models/index.ts index 34d4a4c7..f0f494f3 100644 --- a/packages/analytics.gblib/models/index.ts +++ b/packages/analytics.gblib/models/index.ts @@ -36,12 +36,6 @@ 'use strict'; -import { - DataTypeDate, - DataTypeDecimal, - DataTypes, - DataTypeUUIDv4 -} from 'sequelize'; import { AutoIncrement, diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 58343667..383af961 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -218,7 +218,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ this.provider - }/botServices/${botId}?api-version=${this.apiVersion}`; + }/botServices/${botId}?api-version=${this.apiVersion}`; const url = urlJoin(baseUrl, query); const req = AzureDeployerService.createRequestObject(url, accessToken, 'PATCH', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); @@ -313,7 +313,8 @@ export class AzureDeployerService implements IGBInstallationDeployer { GBLog.info(`Deploying Text Analytics...`); const textAnalytics = await this.createTextAnalytics(name, `${name}-textanalytics`, instance.cloudLocation); keys = await this.cognitiveClient.accounts.listKeys(name, textAnalytics.name); - instance.textAnalyticsEndpoint = textAnalytics.endpoint; + + instance.textAnalyticsEndpoint = textAnalytics.endpoint.replace(`/text/analytics/v2.0`, ''); instance.textAnalyticsKey = keys.key1; GBLog.info(`Deploying NLP...`); @@ -460,7 +461,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const httpClient = new ServiceClient(); let query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${ this.provider - }/botServices/${botId}?api-version=${this.apiVersion}`; + }/botServices/${botId}?api-version=${this.apiVersion}`; let url = urlJoin(baseUrl, query); let req = AzureDeployerService.createRequestObject(url, accessToken, 'PUT', JSON.stringify(parameters)); const res = await httpClient.sendRequest(req); @@ -475,7 +476,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { //tslint:disable-next-line:max-line-length query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/Microsoft.BotService/botServices/${botId}/channels/WebChatChannel/listChannelWithKeys?api-version=${ this.apiVersion - }`; + }`; url = urlJoin(baseUrl, query); req = AzureDeployerService.createRequestObject(url, accessToken, 'POST', JSON.stringify(parameters)); const resChannel = await httpClient.sendRequest(req); @@ -485,7 +486,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { } catch (error) { reject(error); } - }, 20000); + }, 20000); }); } diff --git a/packages/core.gbapp/services/GBCoreService.ts b/packages/core.gbapp/services/GBCoreService.ts index 71e18769..438b1ade 100644 --- a/packages/core.gbapp/services/GBCoreService.ts +++ b/packages/core.gbapp/services/GBCoreService.ts @@ -121,8 +121,8 @@ export class GBCoreService implements IGBCoreService { const logging: boolean | Function = GBConfigService.get('STORAGE_LOGGING') === 'true' ? (str: string): void => { - GBLog.info(str); - } + GBLog.info(str); + } : false; const encrypt: boolean = GBConfigService.get('STORAGE_ENCRYPT') === 'true'; @@ -137,9 +137,10 @@ export class GBCoreService implements IGBCoreService { dialect: this.dialect, storage: storage, dialectOptions: { - encrypt: encrypt - }, - pool: { + options: { + encrypt: encrypt + } + }, pool: { max: 32, min: 8, idle: 40000, @@ -345,8 +346,8 @@ STORAGE_SYNC=true GBCorePackage, GBSecurityPackage, GBKBPackage, - GBCustomerSatisfactionPackage, - GBWhatsappPackage + GBCustomerSatisfactionPackage + // GBWhatsappPackage ].forEach(e => { GBLog.info(`Loading sys package: ${e.name}...`); const p = Object.create(e.prototype) as IGBPackage; diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 12bdf715..07a2de95 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -140,7 +140,7 @@ export class GBMinService { // Install default VBA module. - deployer.deployPackage(min, 'packages/default.gbdialog'); + // DISABLED: deployer.deployPackage(min, 'packages/default.gbdialog'); // Call the loadBot context.activity for all packages. @@ -354,8 +354,8 @@ export class GBMinService { GBAdminPackage, GBKBPackage, GBAnalyticsPackage, - GBCustomerSatisfactionPackage, - GBWhatsappPackage + GBCustomerSatisfactionPackage + // DISABLED: GBWhatsappPackage ].forEach(sysPackage => { const p = Object.create(sysPackage.prototype) as IGBPackage; p.loadBot(min); diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 7b581b8f..d6317880 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -210,25 +210,29 @@ export class KBService { if (subjects) { const where = { from: from, - subject1: undefined, - subject2: undefined, - subject3: undefined, - subject4: undefined + // tslint:disable-next-line: no-null-keyword + subject1: null, + // tslint:disable-next-line: no-null-keyword + subject2: null, + // tslint:disable-next-line: no-null-keyword + subject3: null, + // tslint:disable-next-line: no-null-keyword + subject4: null }; - if (subjects[0]) { + if (subjects[0] && subjects[0].internalId) { where.subject1 = subjects[0].internalId; } - if (subjects[1]) { + if (subjects[1] && subjects[1].internalId) { where.subject2 = subjects[1].internalId; } - if (subjects[2]) { + if (subjects[2] && subjects[2].internalId) { where.subject3 = subjects[2].internalId; } - if (subjects[3]) { + if (subjects[3] && subjects[3].internalId) { where.subject4 = subjects[3].internalId; } @@ -329,7 +333,7 @@ export class KBService { packageId: packageId }); - if (lastAnswer !== null && lastQuestionId !== 0) { + if (lastAnswer !== undefined && lastQuestionId !== 0) { await lastAnswer.update({ nextId: lastQuestionId }); } lastAnswer = answer1; diff --git a/packages/security.gblib/models/index.ts b/packages/security.gblib/models/index.ts index e5e0e924..215be291 100644 --- a/packages/security.gblib/models/index.ts +++ b/packages/security.gblib/models/index.ts @@ -36,30 +36,17 @@ 'use strict'; -import { - DataTypeDate, - DataTypeDecimal, - DataTypes, - DataTypeUUIDv4 -} from 'sequelize'; import { AutoIncrement, BelongsTo, - BelongsToMany, Column, - CreatedAt, DataType, ForeignKey, - HasMany, - IsUUID, Length, Model, PrimaryKey, - Sequelize, - Table, - UpdatedAt -} from 'sequelize-typescript'; + Table} from 'sequelize-typescript'; import { GuaribasInstance } from '../../core.gbapp/models/GBModel'; From 69ca62bd35a725fac1c4ab167f48016782a3010c Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 7 Apr 2019 19:48:47 -0300 Subject: [PATCH 30/32] fix(general): tslint being applied in all sources. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e2161e27..073afdd3 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "botbuilder-choices": "4.0.0-preview1.2", "botbuilder-dialogs": "4.3.4", "botbuilder-prompts": "4.0.0-preview1.2", - "botlib": "0.1.24", + "botlib": "0.1.23", "chai": "4.2.0", "child_process": "^1.0.2", "chokidar": "2.1.5", @@ -88,7 +88,7 @@ "ngrok": "3.1.1", "nyc": "13.3.0", "opn": "6.0.0", - "pragmatismo-io-framework": "1.0.20", + "pragmatismo-io-framework": "1.0.19", "process-exists": "3.1.0", "public-ip": "^3.0.0", "reflect-metadata": "0.1.13", From 6de285e2347c22db53d51c3bdde17eeb18f9f822 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 8 Apr 2019 11:30:01 -0300 Subject: [PATCH 31/32] fix(general): tslint being applied in all sources. --- packages/core.gbapp/services/GBMinService.ts | 2 +- packages/kb.gbapp/dialogs/MenuDialog.ts | 10 ++++++---- packages/kb.gbapp/services/KBService.ts | 2 +- packages/kb.gbapp/strings.ts | 5 ++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 07a2de95..555f36ac 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -458,7 +458,7 @@ export class GBMinService { if (context.activity.name === 'whoAmI') { await step.beginDialog('/whoAmI'); } else if (context.activity.name === 'showSubjects') { - await step.beginDialog('/menu'); + await step.beginDialog('/menu', undefined); } else if (context.activity.name === 'giveFeedback') { await step.beginDialog('/feedback', { fromMenu: true diff --git a/packages/kb.gbapp/dialogs/MenuDialog.ts b/packages/kb.gbapp/dialogs/MenuDialog.ts index 9904fedc..b0e9578d 100644 --- a/packages/kb.gbapp/dialogs/MenuDialog.ts +++ b/packages/kb.gbapp/dialogs/MenuDialog.ts @@ -76,18 +76,20 @@ export class MenuDialog extends IGBDialog { const user = await min.userProfile.get(step.context, {}); const args: MenuDialogArgs = step.options; - let rootSubjectId; + // tslint:disable-next-line: no-null-keyword + let rootSubjectId = null; - if (args !== undefined) { + if (Object.keys(args).length > 0) { // If there is a shortcut specified as subject destination, go there. - if (args.to !== undefined) { + if (args.to !== null) { const dialog = args.to.split(':')[1]; return await step.replaceDialog(`/${dialog}`); } user.subjects.push(args); - rootSubjectId = args.subjectId; + // tslint:disable-next-line: no-null-keyword + rootSubjectId = args.subjectId === undefined ? null : args.subjectId; // Whenever a subject is selected, shows a faq about it. if (user.subjects.length > 0) { diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index d6317880..11029b48 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -73,7 +73,7 @@ export class KBService { } public static getFormattedSubjectItems(subjects: GuaribasSubject[]) { - if (subjects !== null) { + if (subjects === null) { return ''; } const out = []; diff --git a/packages/kb.gbapp/strings.ts b/packages/kb.gbapp/strings.ts index 787d1305..341af5a0 100644 --- a/packages/kb.gbapp/strings.ts +++ b/packages/kb.gbapp/strings.ts @@ -10,9 +10,8 @@ export const Messages = { here_is_subjects: 'Here are some subjects to choose from...', menu_select: 'Select', lets_search: query => - `Vamos pesquisar sobre ${query}... O que deseja saber?`, - see_faq: - 'Please take a look at the FAQ I\'ve prepared for you. You can click on them to get the answer.', + `Lets search for ${query}... What do you want to know?`, + see_faq: 'Please take a look at the FAQ I\'ve prepared for you. You can click on them to get the answer.', will_answer_projector: 'I\'ll answer on the projector to a better experience...', ask_first_time: 'What are you looking for?' From ef3c5a18e2412e56b0e336503d6b719b39a3a40c Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 8 Apr 2019 11:59:55 -0300 Subject: [PATCH 32/32] fix(general): tslint being applied in all sources. --- package-lock.json | 281 ++-------------------------------------------- package.json | 2 +- 2 files changed, 12 insertions(+), 271 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3724beea..8b904408 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1539,7 +1539,8 @@ "@types/bluebird": { "version": "3.5.18", "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.18.tgz", - "integrity": "sha512-OTPWHmsyW18BhrnG5x8F7PzeZ2nFxmHGb42bZn79P9hl+GI5cMzyPgQTwNjbem0lJhoru/8vtjAFCUOu3+gE2w==" + "integrity": "sha512-OTPWHmsyW18BhrnG5x8F7PzeZ2nFxmHGb42bZn79P9hl+GI5cMzyPgQTwNjbem0lJhoru/8vtjAFCUOu3+gE2w==", + "dev": true }, "@types/caseless": { "version": "0.12.1", @@ -1594,11 +1595,6 @@ "@types/node": "*" } }, - "@types/geojson": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-1.0.6.tgz", - "integrity": "sha512-Xqg/lIZMrUd0VRmSRbCAewtwGZiAk3mEUDvV4op1tGl+LvyPcb/MIOSxTl9z+9+J+R4/vpjiCAT4xeKzH9ji1w==" - }, "@types/glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", @@ -3189,16 +3185,16 @@ "integrity": "sha512-8t+pyoMC1zN0w223SLh+qFe19ILYxcC12VPRRPXS8dydFqnCf8nV+SOpXoVFsx0eaKIhWXe868olz+Ms3ihTkA==" }, "botlib": { - "version": "0.1.23", - "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.23.tgz", - "integrity": "sha512-hYDLME5hDuPJcPJ7wUU8rDjZ9WX8yfkDwEwaO8QbVxlKttygZuxs0Yu1dFBdNxjg7fdrqmZF560Z3DliyhkVhg==", + "version": "0.1.24", + "resolved": "https://registry.npmjs.org/botlib/-/botlib-0.1.24.tgz", + "integrity": "sha512-DJGDKVouvsV32dzjvZwfo55YE8LslTpO496C3AyDEv3X/K8hRxVhb6bwW5hY74Z3P6xnorGMSimKKNR+b5iFCg==", "requires": { "async": "2.6.2", - "botbuilder": "4.1.7", - "botbuilder-ai": "4.2.0", - "botbuilder-azure": "4.2.0", + "botbuilder": "4.3.4", + "botbuilder-ai": "4.3.4", + "botbuilder-azure": "4.3.4", "botbuilder-choices": "4.0.0-preview1.2", - "botbuilder-dialogs": "4.2.0", + "botbuilder-dialogs": "4.3.4", "botbuilder-prompts": "4.0.0-preview1.2", "chrono-node": "1.3.11", "dotenv-extended": "2.4.0", @@ -3206,173 +3202,12 @@ "ms": "2.1.1", "pragmatismo-io-framework": "1.0.19", "reflect-metadata": "0.1.13", - "sequelize": "4.43.0", - "sequelize-typescript": "0.6.7", + "sequelize": "5.2.12", + "sequelize-typescript": "0.6.9", "wait-until": "0.0.2", "winston": "3.2.1" }, "dependencies": { - "@microsoft/recognizers-text-choice": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-choice/-/recognizers-text-choice-1.1.2.tgz", - "integrity": "sha512-4hFdqxusM0YrOXYM2RVYPl2rLjItSh6VkRiACjWB95GKC/DBGjJRYQpTxhzuZAsJSkDMinu/aLf8DvQtwUaLtA==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "grapheme-splitter": "^1.0.2" - } - }, - "@microsoft/recognizers-text-number": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.2.tgz", - "integrity": "sha512-GESjSF42dllym83diyd6pmlzFwdzidewoq/qSQz89lSoTx9HdJQHjbXxwdBp7w4Ax/Jroo2lcAedM3B7alZhYQ==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "bignumber.js": "^7.2.1", - "lodash.escaperegexp": "^4.1.2", - "lodash.sortby": "^4.7.0", - "lodash.trimend": "^4.5.1" - } - }, - "@microsoft/recognizers-text-suite": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-suite/-/recognizers-text-suite-1.1.2.tgz", - "integrity": "sha512-w3WCsKa//64jE1fGPFlV02rRg9+b3oDp+K5/skPAn4KDr80LjXxD1ulIgiJ2Ll/2OoBl8ociCiCjYA7zS3LpdQ==", - "requires": { - "@microsoft/recognizers-text": "~1.1.2", - "@microsoft/recognizers-text-choice": "~1.1.2", - "@microsoft/recognizers-text-date-time": "~1.1.2", - "@microsoft/recognizers-text-number": "~1.1.2", - "@microsoft/recognizers-text-number-with-unit": "~1.1.2", - "@microsoft/recognizers-text-sequence": "~1.1.2" - } - }, - "@types/node": { - "version": "9.6.47", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.47.tgz", - "integrity": "sha512-56wEJWXZs+3XXoTe/OCpdZ6czrONhy+6hT0GdPOb7HvudLTMJ1T5tuZPs37K5cPR5t+J9+vLPFDQgUQ8NWJE1w==" - }, - "@types/sequelize": { - "version": "4.27.24", - "resolved": "https://registry.npmjs.org/@types/sequelize/-/sequelize-4.27.24.tgz", - "integrity": "sha512-5uMFsMa/0hU/7/8znyfBKSJy2Mbd57uRpYk5X1+Phz9dN0MRZLbTbj1JMeB3CJ4R9b1coNQGfp2kXh4OjI9UyA==", - "requires": { - "@types/bluebird": "*", - "@types/continuation-local-storage": "*", - "@types/lodash": "*", - "@types/validator": "*" - } - }, - "botbuilder": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.1.7.tgz", - "integrity": "sha512-AlZhvjeqiCpeWGN1TkqBi09l6f0spYIh0Xzc4rJYF8feCFi4k2FEYC1IpiiOAtYhEBeQ9SOGFcUUwPaLmsI3Xg==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^9.3.0", - "async-file": "^2.0.2", - "botbuilder-core": "^4.1.7", - "botframework-connector": "^4.1.7", - "filenamify": "^2.0.0", - "rimraf": "^2.6.2" - } - }, - "botbuilder-ai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-ai/-/botbuilder-ai-4.2.0.tgz", - "integrity": "sha512-dt2OydZ9pWyMSNgha3PlC6lBq3sXUXAYmadqogNqvWpYEmIMdBOCUc02Vn2w1suxLX84GdYqdBI2klwrRZ7oKg==", - "requires": { - "@microsoft/recognizers-text-date-time": "1.1.2", - "@types/html-entities": "^1.2.16", - "@types/node": "^9.3.0", - "@types/request-promise-native": "^1.0.10", - "azure-cognitiveservices-luis-runtime": "^1.0.0", - "botbuilder": "^4.2.0", - "html-entities": "^1.2.1", - "moment": "^2.20.1", - "ms-rest": "^2.3.6", - "mstranslator": "^3.0.0", - "request": "^2.87.0", - "request-promise-native": "1.0.5" - }, - "dependencies": { - "botbuilder": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.4.tgz", - "integrity": "sha512-7EizagbDXGKCwHlQi0ICp1UpjBXxlha2c67y1XxaXzORWJyCTmd8HNP2iFdnxsZUGluh90jgN4C1hmJLBzSCUw==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^10.12.18", - "async-file": "^2.0.2", - "botbuilder-core": "^4.3.4", - "botframework-connector": "^4.3.4", - "filenamify": "^2.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.14.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", - "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" - } - } - } - } - }, - "botbuilder-azure": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-azure/-/botbuilder-azure-4.2.0.tgz", - "integrity": "sha512-WL8dHtVESE/qTFTGcJwlFeKyUeewoyoNr5ENavu1W40N8UjZB32ivmX2dvd0Zm4TIbeBwgmomF2gE9rE+0Rv3w==", - "requires": { - "@types/node": "^9.3.0", - "azure-storage": "^2.10.2", - "botbuilder": "^4.2.0", - "documentdb": "1.14.5", - "flat": "^4.0.0", - "semaphore": "^1.1.0" - }, - "dependencies": { - "botbuilder": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/botbuilder/-/botbuilder-4.3.4.tgz", - "integrity": "sha512-7EizagbDXGKCwHlQi0ICp1UpjBXxlha2c67y1XxaXzORWJyCTmd8HNP2iFdnxsZUGluh90jgN4C1hmJLBzSCUw==", - "requires": { - "@types/filenamify": "^2.0.1", - "@types/node": "^10.12.18", - "async-file": "^2.0.2", - "botbuilder-core": "^4.3.4", - "botframework-connector": "^4.3.4", - "filenamify": "^2.0.0" - }, - "dependencies": { - "@types/node": { - "version": "10.14.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.4.tgz", - "integrity": "sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==" - } - } - } - } - }, - "botbuilder-dialogs": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/botbuilder-dialogs/-/botbuilder-dialogs-4.2.0.tgz", - "integrity": "sha512-wi7Vk/mRHqsjNVhCbXK6yoYsQ7uS7EySM+bcDRthw5uDQ9LyHHoRg3wzT+mqbfjzwgpKR/TXxPUDM4nDL8Hz+Q==", - "requires": { - "@microsoft/recognizers-text-choice": "1.1.2", - "@microsoft/recognizers-text-date-time": "1.1.2", - "@microsoft/recognizers-text-number": "1.1.2", - "@microsoft/recognizers-text-suite": "1.1.2", - "@types/node": "^9.3.0", - "botbuilder-core": "^4.2.0" - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3380,64 +3215,6 @@ "requires": { "safer-buffer": ">= 2.1.2 < 3" } - }, - "request-promise-native": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", - "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", - "requires": { - "request-promise-core": "1.1.1", - "stealthy-require": "^1.1.0", - "tough-cookie": ">=2.3.3" - } - }, - "sequelize": { - "version": "4.43.0", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-4.43.0.tgz", - "integrity": "sha512-GkwGFVREKBf/ql6W6RXwXy1fzb/HOk0lmOBbcQrJMvJtB65Jfg7CUh+sENh0deuWk5s79JedgZJ/yEjvtzHXaQ==", - "requires": { - "bluebird": "^3.5.0", - "cls-bluebird": "^2.1.0", - "debug": "^3.1.0", - "depd": "^1.1.0", - "dottie": "^2.0.0", - "generic-pool": "3.5.0", - "inflection": "1.12.0", - "lodash": "^4.17.1", - "moment": "^2.20.0", - "moment-timezone": "^0.5.14", - "retry-as-promised": "^2.3.2", - "semver": "^5.5.0", - "terraformer-wkt-parser": "^1.1.2", - "toposort-class": "^1.0.1", - "uuid": "^3.2.1", - "validator": "^10.4.0", - "wkx": "^0.4.1" - } - }, - "sequelize-typescript": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/sequelize-typescript/-/sequelize-typescript-0.6.7.tgz", - "integrity": "sha512-ae21Gq9VOVXlIjnh2vLdL42Kev6r4LC82xOQ2fXo0lHzQvjFeH8/GaWUlpvYv57AOgc+ZnElbYFbSLKdT9ue0w==", - "requires": { - "@types/bluebird": "3.5.18", - "@types/node": "6.0.41", - "@types/sequelize": "4.27.24", - "es6-shim": "0.35.3", - "glob": "7.1.2" - }, - "dependencies": { - "@types/node": { - "version": "6.0.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.41.tgz", - "integrity": "sha1-V4z1Oq7GWIe8rxZ5L4ciky6P+Oo=" - } - } - }, - "validator": { - "version": "10.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", - "integrity": "sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==" } } }, @@ -7147,11 +6924,6 @@ "is-property": "^1.0.0" } }, - "generic-pool": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.5.0.tgz", - "integrity": "sha512-dEkxmX+egB2o4NR80c/q+xzLLzLX+k68/K8xv81XprD+Sk7ZtP14VugeCz+fUwv5FzpWq40pPtAkzPRqT8ka9w==" - }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", @@ -9779,11 +9551,6 @@ "xml2js": "^0.4.19" } }, - "mstranslator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mstranslator/-/mstranslator-3.0.0.tgz", - "integrity": "sha1-ancOpFD/tMZfaNXmruBRuC3gXPM=" - }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -15787,15 +15554,6 @@ "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", "dev": true }, - "retry-as-promised": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-2.3.2.tgz", - "integrity": "sha1-zZdO5P2bX+A8vzGHHuSCIcB3N7c=", - "requires": { - "bluebird": "^3.4.6", - "debug": "^2.6.9" - } - }, "right-pad": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz", @@ -17430,23 +17188,6 @@ "execa": "^0.7.0" } }, - "terraformer": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/terraformer/-/terraformer-1.0.9.tgz", - "integrity": "sha512-YlmQ1fsMWTkKGDGibCRWgmLzrpDRUr63Q025LJ/taYQ6j1Yb8q9McKF7NBi6ACAyUXO6F/bl9w6v4MY307y5Ag==", - "requires": { - "@types/geojson": "^1.0.0" - } - }, - "terraformer-wkt-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/terraformer-wkt-parser/-/terraformer-wkt-parser-1.2.0.tgz", - "integrity": "sha512-QU3iA54St5lF8Za1jg1oj4NYc8sn5tCZ08aNSWDeGzrsaV48eZk1iAVWasxhNspYBoCqdHuoot1pUTUrE1AJ4w==", - "requires": { - "@types/geojson": "^1.0.0", - "terraformer": "~1.0.5" - } - }, "text-extensions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", diff --git a/package.json b/package.json index 073afdd3..b7cca44a 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "botbuilder-choices": "4.0.0-preview1.2", "botbuilder-dialogs": "4.3.4", "botbuilder-prompts": "4.0.0-preview1.2", - "botlib": "0.1.23", + "botlib": "0.1.24", "chai": "4.2.0", "child_process": "^1.0.2", "chokidar": "2.1.5",