new(admin.gbapp): custom .gbapp /publish commands.
This commit is contained in:
		
							parent
							
								
									c36939e221
								
							
						
					
					
						commit
						a7712fba28
					
				
					 4 changed files with 19 additions and 14 deletions
				
			
		
							
								
								
									
										6
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -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
 | 
					 | 
				
			||||||
poc/
 | 
					 | 
				
			||||||
*.env
 | 
					*.env
 | 
				
			||||||
 | 
					.vscode/launch.json
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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;
 | 
				
			||||||
 | 
					              try {
 | 
				
			||||||
                await this.setValue(instanceId, 'accessToken', token.accessToken);
 | 
					                await this.setValue(instanceId, 'accessToken', token.accessToken);
 | 
				
			||||||
                await this.setValue(instanceId, 'refreshToken', token.refreshToken);
 | 
					                await this.setValue(instanceId, 'refreshToken', token.refreshToken);
 | 
				
			||||||
                await this.setValue(instanceId, 'expiresOn', token.expiresOn.toString());
 | 
					                await this.setValue(instanceId, 'expiresOn', token.expiresOn.toString());
 | 
				
			||||||
                resolve(token.accessToken);
 | 
					                resolve(token.accessToken);
 | 
				
			||||||
 | 
					              } catch (error) {
 | 
				
			||||||
 | 
					                reject(err);
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue