new(admin.gbapp): custom .gbapp /publish commands.

This commit is contained in:
Rodrigo Rodriguez 2020-10-17 23:03:27 -03:00
parent c36939e221
commit a7712fba28
4 changed files with 19 additions and 14 deletions

8
.gitignore vendored
View file

@ -11,14 +11,10 @@
/packages/default.gbui/build /packages/default.gbui/build
/packages/default.gbui/.env /packages/default.gbui/.env
/packages/default.gbui/node_modules /packages/default.gbui/node_modules
/tmp
/work /work
/packages/default.gbdialog/bot.js
/packages/default.gbdialog/bot.ts
*.vbs.compiled *.vbs.compiled
*.vbs.js *.vbs.js
*.vbs.ts *.vbs.ts
.env .env
teste.sql *.env
poc/ .vscode/launch.json
*.env

View file

@ -198,7 +198,7 @@ export class AdminDialog extends IGBDialog {
if (AdminDialog.isIntentYes(locale, step.result)) { if (AdminDialog.isIntentYes(locale, step.result)) {
step.activeDialog.state.options.args; step.activeDialog.state.options.args;
for (let index = 0; index < min.appPackages.length; index++) { for (let index = 0; index < min.appPackages.length; index++) {
const element = min.appPackages[index]; const element = min.appPackages[index];
await element.onExchangeData(min, 'install', null); await element.onExchangeData(min, 'install', null);
@ -273,8 +273,12 @@ export class AdminDialog extends IGBDialog {
await CollectionUtil.asyncForEach(packages, async packageName => { await CollectionUtil.asyncForEach(packages, async packageName => {
try { try {
const cmd1 = `deployPackage ${process.env.STORAGE_SITE} /${process.env.STORAGE_LIBRARY}/${botId}.gbai/${packageName}`; let cmd1;
if (packageName.indexOf('.') !== -1) {
cmd1 = `deployPackage ${process.env.STORAGE_SITE} /${process.env.STORAGE_LIBRARY}/${botId}.gbai/${packageName}`;
} else {
cmd1 = `deployPackage ${packageName}`;
}
if ((await (deployer as any).getStoragePackageByName(min.instance.instanceId, packageName)) !== null) { if ((await (deployer as any).getStoragePackageByName(min.instance.instanceId, packageName)) !== null) {
const cmd2 = `undeployPackage ${packageName}`; const cmd2 = `undeployPackage ${packageName}`;
await GBAdminService.undeployPackageCommand(cmd2, min); await GBAdminService.undeployPackageCommand(cmd2, min);

View file

@ -201,10 +201,14 @@ export class GBAdminService implements IGBAdminService {
reject(err); reject(err);
} else { } else {
const token = res as TokenResponse; const token = res as TokenResponse;
await this.setValue(instanceId, 'accessToken', token.accessToken); try {
await this.setValue(instanceId, 'refreshToken', token.refreshToken); await this.setValue(instanceId, 'accessToken', token.accessToken);
await this.setValue(instanceId, 'expiresOn', token.expiresOn.toString()); await this.setValue(instanceId, 'refreshToken', token.refreshToken);
resolve(token.accessToken); await this.setValue(instanceId, 'expiresOn', token.expiresOn.toString());
resolve(token.accessToken);
} catch (error) {
reject(err);
}
} }
} }
); );

View file

@ -330,8 +330,9 @@ export class GBMinService {
GBLog.error(msg); GBLog.error(msg);
res.send(msg); res.send(msg);
} else { } else {
this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken); // TODO: await these calls.
this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken); this.adminService.setValue(instance.instanceId, 'accessToken', token.accessToken);
this.adminService.setValue(instance.instanceId, 'refreshToken', token.refreshToken);
this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString()); this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString());
this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', undefined); this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', undefined);
res.redirect(min.instance.botEndpoint); res.redirect(min.instance.botEndpoint);