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/.env
/packages/default.gbui/node_modules
/tmp
/work
/packages/default.gbdialog/bot.js
/packages/default.gbdialog/bot.ts
*.vbs.compiled
*.vbs.js
*.vbs.ts
.env
teste.sql
poc/
*.env
*.env
.vscode/launch.json

View file

@ -198,7 +198,7 @@ export class AdminDialog extends IGBDialog {
if (AdminDialog.isIntentYes(locale, step.result)) {
step.activeDialog.state.options.args;
for (let index = 0; index < min.appPackages.length; index++) {
const element = min.appPackages[index];
await element.onExchangeData(min, 'install', null);
@ -273,8 +273,12 @@ export class AdminDialog extends IGBDialog {
await CollectionUtil.asyncForEach(packages, async packageName => {
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) {
const cmd2 = `undeployPackage ${packageName}`;
await GBAdminService.undeployPackageCommand(cmd2, min);

View file

@ -201,10 +201,14 @@ export class GBAdminService implements IGBAdminService {
reject(err);
} else {
const token = res as TokenResponse;
await this.setValue(instanceId, 'accessToken', token.accessToken);
await this.setValue(instanceId, 'refreshToken', token.refreshToken);
await this.setValue(instanceId, 'expiresOn', token.expiresOn.toString());
resolve(token.accessToken);
try {
await this.setValue(instanceId, 'accessToken', token.accessToken);
await this.setValue(instanceId, 'refreshToken', token.refreshToken);
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);
res.send(msg);
} 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, 'refreshToken', token.refreshToken);
this.adminService.setValue(instance.instanceId, 'expiresOn', token.expiresOn.toString());
this.adminService.setValue(instance.instanceId, 'AntiCSRFAttackState', undefined);
res.redirect(min.instance.botEndpoint);