new(core.gbapp): FIND keyword tested on MSExcel.
This commit is contained in:
		
							parent
							
								
									9968ff6be6
								
							
						
					
					
						commit
						daeaf8a8e5
					
				
					 11 changed files with 71 additions and 51 deletions
				
			
		| 
						 | 
					@ -17,4 +17,16 @@ GO
 | 
				
			||||||
ALTER TABLE [dbo].[GuaribasUser] DROP COLUMN [currentBotId]
 | 
					ALTER TABLE [dbo].[GuaribasUser] DROP COLUMN [currentBotId]
 | 
				
			||||||
GO
 | 
					GO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 1.7.7
 | 
				
			||||||
 | 
					``` SQL
 | 
				
			||||||
 | 
					ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [authenticatorClientId]
 | 
				
			||||||
 | 
					GO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [authenticatorClientSecret]
 | 
				
			||||||
 | 
					GO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
| 
						 | 
					@ -66,7 +66,7 @@
 | 
				
			||||||
    "botbuilder-ai": "4.7.0",
 | 
					    "botbuilder-ai": "4.7.0",
 | 
				
			||||||
    "botbuilder-dialogs": "4.7.0",
 | 
					    "botbuilder-dialogs": "4.7.0",
 | 
				
			||||||
    "botframework-connector": "4.7.0",
 | 
					    "botframework-connector": "4.7.0",
 | 
				
			||||||
    "botlib": "1.5.0",
 | 
					    "botlib": "1.5.1",
 | 
				
			||||||
    "chai": "4.2.0",
 | 
					    "chai": "4.2.0",
 | 
				
			||||||
    "cli-spinner": "0.2.10",
 | 
					    "cli-spinner": "0.2.10",
 | 
				
			||||||
    "csv-parse": "4.8.3",
 | 
					    "csv-parse": "4.8.3",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -222,27 +222,11 @@ export class AdminDialog extends IGBDialog {
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        async step => {
 | 
					        async step => {
 | 
				
			||||||
          step.activeDialog.state.authenticatorAuthorityHostUrl = step.result;
 | 
					          step.activeDialog.state.authenticatorAuthorityHostUrl = step.result;
 | 
				
			||||||
          const locale = step.context.activity.locale;
 | 
					 | 
				
			||||||
          const prompt = Messages[locale].enter_authenticator_client_id;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          return await step.prompt('textPrompt', prompt);
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        async step => {
 | 
					 | 
				
			||||||
          step.activeDialog.state.authenticatorClientId = step.result;
 | 
					 | 
				
			||||||
          const locale = step.context.activity.locale;
 | 
					 | 
				
			||||||
          const prompt = Messages[locale].enter_authenticator_client_secret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          return await step.prompt('textPrompt', prompt);
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        async step => {
 | 
					 | 
				
			||||||
          step.activeDialog.state.authenticatorClientSecret = step.result;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
          await min.adminService.updateSecurityInfo(
 | 
					          await min.adminService.updateSecurityInfo(
 | 
				
			||||||
            min.instance.instanceId,
 | 
					            min.instance.instanceId,
 | 
				
			||||||
            step.activeDialog.state.authenticatorTenant,
 | 
					            step.activeDialog.state.authenticatorTenant,
 | 
				
			||||||
            step.activeDialog.state.authenticatorAuthorityHostUrl,
 | 
					            step.activeDialog.state.authenticatorAuthorityHostUrl
 | 
				
			||||||
            step.activeDialog.state.authenticatorClientId,
 | 
					 | 
				
			||||||
            step.activeDialog.state.authenticatorClientSecret
 | 
					 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          const locale = step.context.activity.locale;
 | 
					          const locale = step.context.activity.locale;
 | 
				
			||||||
| 
						 | 
					@ -253,7 +237,7 @@ export class AdminDialog extends IGBDialog {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          const url = `https://login.microsoftonline.com/${
 | 
					          const url = `https://login.microsoftonline.com/${
 | 
				
			||||||
            min.instance.authenticatorTenant
 | 
					            min.instance.authenticatorTenant
 | 
				
			||||||
            }/oauth2/authorize?client_id=${min.instance.authenticatorClientId}&response_type=code&redirect_uri=${urlJoin(
 | 
					            }/oauth2/authorize?client_id=${min.instance.marketplaceId}&response_type=code&redirect_uri=${urlJoin(
 | 
				
			||||||
              min.instance.botEndpoint,
 | 
					              min.instance.botEndpoint,
 | 
				
			||||||
              min.instance.botId,
 | 
					              min.instance.botId,
 | 
				
			||||||
              '/token'
 | 
					              '/token'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -133,17 +133,13 @@ export class GBAdminService implements IGBAdminService {
 | 
				
			||||||
  public async updateSecurityInfo(
 | 
					  public async updateSecurityInfo(
 | 
				
			||||||
    instanceId: number,
 | 
					    instanceId: number,
 | 
				
			||||||
    authenticatorTenant: string,
 | 
					    authenticatorTenant: string,
 | 
				
			||||||
    authenticatorAuthorityHostUrl: string,
 | 
					    authenticatorAuthorityHostUrl: string
 | 
				
			||||||
    authenticatorClientId: string,
 | 
					 | 
				
			||||||
    authenticatorClientSecret: string
 | 
					 | 
				
			||||||
  ): Promise<IGBInstance> {
 | 
					  ): Promise<IGBInstance> {
 | 
				
			||||||
    const options = { where: {} };
 | 
					    const options = { where: {} };
 | 
				
			||||||
    options.where = { instanceId: instanceId };
 | 
					    options.where = { instanceId: instanceId };
 | 
				
			||||||
    const item = await GuaribasInstance.findOne(options);
 | 
					    const item = await GuaribasInstance.findOne(options);
 | 
				
			||||||
    item.authenticatorTenant = authenticatorTenant;
 | 
					    item.authenticatorTenant = authenticatorTenant;
 | 
				
			||||||
    item.authenticatorAuthorityHostUrl = authenticatorAuthorityHostUrl;
 | 
					    item.authenticatorAuthorityHostUrl = authenticatorAuthorityHostUrl;
 | 
				
			||||||
    item.authenticatorClientId = authenticatorClientId;
 | 
					 | 
				
			||||||
    item.authenticatorClientSecret = authenticatorClientSecret;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return item.save();
 | 
					    return item.save();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -182,8 +178,8 @@ export class GBAdminService implements IGBAdminService {
 | 
				
			||||||
        const authenticationContext = new AuthenticationContext(authorizationUrl);
 | 
					        const authenticationContext = new AuthenticationContext(authorizationUrl);
 | 
				
			||||||
        authenticationContext.acquireTokenWithRefreshToken(
 | 
					        authenticationContext.acquireTokenWithRefreshToken(
 | 
				
			||||||
          refreshToken,
 | 
					          refreshToken,
 | 
				
			||||||
          instance.authenticatorClientId,
 | 
					          instance.marketplaceId,
 | 
				
			||||||
          instance.authenticatorClientSecret,
 | 
					          instance.marketplacePassword,
 | 
				
			||||||
          resource,
 | 
					          resource,
 | 
				
			||||||
          async (err, res) => {
 | 
					          async (err, res) => {
 | 
				
			||||||
            if (err !== null) {
 | 
					            if (err !== null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,12 +108,6 @@ export class GuaribasInstance extends Model<GuaribasInstance>
 | 
				
			||||||
  @Column
 | 
					  @Column
 | 
				
			||||||
  public authenticatorAuthorityHostUrl: string;
 | 
					  public authenticatorAuthorityHostUrl: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Column
 | 
					 | 
				
			||||||
  public authenticatorClientId: string;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @Column
 | 
					 | 
				
			||||||
  public authenticatorClientSecret: string;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @Column
 | 
					  @Column
 | 
				
			||||||
  public cloudSubscriptionId: string;
 | 
					  public cloudSubscriptionId: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -157,7 +157,8 @@ class SysClass {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    const botId = this.min.instance.botId;
 | 
					    const botId = this.min.instance.botId;
 | 
				
			||||||
    const path = `/${botId}/${botId}.gbdata`;
 | 
					
 | 
				
			||||||
 | 
					    const path = `/${botId}.gbai/${botId}.gbdata`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let res = await client.api(
 | 
					    let res = await client.api(
 | 
				
			||||||
      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`)
 | 
					      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`)
 | 
				
			||||||
| 
						 | 
					@ -187,7 +188,7 @@ class SysClass {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const session = await client.api(
 | 
					    const session = await client.api(
 | 
				
			||||||
      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/createSession`)
 | 
					      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/createSession`)
 | 
				
			||||||
      .get(body);
 | 
					      .post(body);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Applies filtering.
 | 
					    // Applies filtering.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -199,21 +200,29 @@ class SysClass {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let filtered = await client.api(
 | 
					    await client.api(
 | 
				
			||||||
      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/worksheets('Sheet1')/tables(id='Table1')/columns('${columnName}')/filter/apply`)
 | 
					      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/worksheets('Sheet1')/tables(id='Table1')/columns('${columnName}')/filter/apply`)
 | 
				
			||||||
      .headers("workbook-session-id", session.session_Id)
 | 
					      .headers("workbook-session-id", session.id)
 | 
				
			||||||
      .get(bodyFilter);
 | 
					      .post(bodyFilter);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Get the filtered values.
 | 
					    // Get the filtered values.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let results = await client.api(
 | 
					    let results = await client.api(
 | 
				
			||||||
      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/worksheets('Sheet1')/tables('Table1')/range/visibleView/rows?$select=values`)
 | 
					      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/worksheets('Sheet1')/tables('Table1')/range/visibleView/rows?$select=values`)
 | 
				
			||||||
      .headers("workbook-session-id", session.session_Id)
 | 
					      .headers("workbook-session-id", session.id)
 | 
				
			||||||
      .get(bodyFilter);
 | 
					      .get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return results;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // Translate an array into a readable BASIC object.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      let output = {};         
 | 
				
			||||||
 | 
					      results.value[1].values[0]
 | 
				
			||||||
 | 
					      const firstRow = results.value[0];
 | 
				
			||||||
 | 
					      for (let index = 0; index < firstRow.values[0].length; index++) {
 | 
				
			||||||
 | 
					        output[firstRow.values[0][index]] = results.value[1].values[0][index];
 | 
				
			||||||
 | 
					      }      
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return output;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public generatePassword() {
 | 
					  public generatePassword() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -433,7 +433,7 @@ STORAGE_SYNC=true
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  public async createBootInstance(
 | 
					  public async createBootInstance(
 | 
				
			||||||
    core: GBCoreService,
 | 
					    core: GBCoreService,
 | 
				
			||||||
    installationDeployer: IGBInstallationDeployer,
 | 
					    installationDeployer: IGBInstallationDeployer,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -210,7 +210,6 @@ export class GBMinService {
 | 
				
			||||||
    const { min, adapter, conversationState } = await this.buildBotAdapter(instance, GBServer.globals.sysPackages);
 | 
					    const { min, adapter, conversationState } = await this.buildBotAdapter(instance, GBServer.globals.sysPackages);
 | 
				
			||||||
    GBServer.globals.minInstances.push(min);
 | 
					    GBServer.globals.minInstances.push(min);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.deployer.deployPackage(min, 'packages/default.gbdialog');
 | 
					    this.deployer.deployPackage(min, 'packages/default.gbdialog');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Install per bot deployed packages.
 | 
					    // Install per bot deployed packages.
 | 
				
			||||||
| 
						 | 
					@ -299,8 +298,8 @@ export class GBMinService {
 | 
				
			||||||
        req.query.code,
 | 
					        req.query.code,
 | 
				
			||||||
        urlJoin(instance.botEndpoint, min.instance.botId, '/token'),
 | 
					        urlJoin(instance.botEndpoint, min.instance.botId, '/token'),
 | 
				
			||||||
        resource,
 | 
					        resource,
 | 
				
			||||||
        instance.authenticatorClientId,
 | 
					        instance.marketplaceId,
 | 
				
			||||||
        instance.authenticatorClientSecret,
 | 
					        instance.marketplacePassword,
 | 
				
			||||||
        async (err, token) => {
 | 
					        async (err, token) => {
 | 
				
			||||||
          if (err) {
 | 
					          if (err) {
 | 
				
			||||||
            const msg = `Error acquiring token: ${err}`;
 | 
					            const msg = `Error acquiring token: ${err}`;
 | 
				
			||||||
| 
						 | 
					@ -326,7 +325,7 @@ export class GBMinService {
 | 
				
			||||||
        '/oauth2/authorize'
 | 
					        '/oauth2/authorize'
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
      authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${
 | 
					      authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${
 | 
				
			||||||
        min.instance.authenticatorClientId
 | 
					        min.instance.marketplaceId
 | 
				
			||||||
        }&redirect_uri=${urlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`;
 | 
					        }&redirect_uri=${urlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`;
 | 
				
			||||||
      res.redirect(authorizationUrl);
 | 
					      res.redirect(authorizationUrl);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					@ -357,7 +356,7 @@ export class GBMinService {
 | 
				
			||||||
          speechToken: speechToken,
 | 
					          speechToken: speechToken,
 | 
				
			||||||
          conversationId: webchatTokenContainer.conversationId,
 | 
					          conversationId: webchatTokenContainer.conversationId,
 | 
				
			||||||
          authenticatorTenant: instance.authenticatorTenant,
 | 
					          authenticatorTenant: instance.authenticatorTenant,
 | 
				
			||||||
          authenticatorClientId: instance.authenticatorClientId
 | 
					          authenticatorClientId: instance.marketplaceId
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -262,9 +262,7 @@ export class GBVMService extends GBService {
 | 
				
			||||||
        GBLog.info(`[GBVMService] Finished loading of ${filename}`);
 | 
					        GBLog.info(`[GBVMService] Finished loading of ${filename}`);
 | 
				
			||||||
      } catch (error) {
 | 
					      } catch (error) {
 | 
				
			||||||
        GBLog.error(`[GBVMService] ERROR loading ${error}`);
 | 
					        GBLog.error(`[GBVMService] ERROR loading ${error}`);
 | 
				
			||||||
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,4 +18,33 @@ else
 | 
				
			||||||
    end if
 | 
					    end if
 | 
				
			||||||
end if
 | 
					end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
talk "Valeu!"
 | 
					talk "Valeu!"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Falar "Qual seu nome?"
 | 
				
			||||||
 | 
					Ouvir nome
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Falar "Informe seu CEP, por favor:"
 | 
				
			||||||
 | 
					Ouvir CEP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Address = CEP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Confira seu endereço:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Address.Street
 | 
				
			||||||
 | 
					Address.Number
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Falar "Manda sua localização para eu pedir a alguém para sair agora com o seu pedido"
 | 
				
			||||||
 | 
					Hear Location
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SAve "Pedidos.xlsx", Nome, From, Location.Street, Location.Number
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Falar "Manda sua localização que eu encontro o posto mais próximo"
 | 
				
			||||||
 | 
					Hear Location
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Find "Postos.xlsx", "Endereço=" + Location
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,6 @@ import { GBCoreService } from '../packages/core.gbapp/services/GBCoreService';
 | 
				
			||||||
import { GBDeployer } from '../packages/core.gbapp/services/GBDeployer';
 | 
					import { GBDeployer } from '../packages/core.gbapp/services/GBDeployer';
 | 
				
			||||||
import { GBImporter } from '../packages/core.gbapp/services/GBImporterService';
 | 
					import { GBImporter } from '../packages/core.gbapp/services/GBImporterService';
 | 
				
			||||||
import { GBMinService } from '../packages/core.gbapp/services/GBMinService';
 | 
					import { GBMinService } from '../packages/core.gbapp/services/GBMinService';
 | 
				
			||||||
import { GBWhatsappPackage } from '../packages/whatsapp.gblib';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Global shared server data;
 | 
					 * Global shared server data;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue