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]
 | 
			
		||||
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-dialogs": "4.7.0",
 | 
			
		||||
    "botframework-connector": "4.7.0",
 | 
			
		||||
    "botlib": "1.5.0",
 | 
			
		||||
    "botlib": "1.5.1",
 | 
			
		||||
    "chai": "4.2.0",
 | 
			
		||||
    "cli-spinner": "0.2.10",
 | 
			
		||||
    "csv-parse": "4.8.3",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -222,27 +222,11 @@ export class AdminDialog extends IGBDialog {
 | 
			
		|||
        },
 | 
			
		||||
        async step => {
 | 
			
		||||
          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(
 | 
			
		||||
            min.instance.instanceId,
 | 
			
		||||
            step.activeDialog.state.authenticatorTenant,
 | 
			
		||||
            step.activeDialog.state.authenticatorAuthorityHostUrl,
 | 
			
		||||
            step.activeDialog.state.authenticatorClientId,
 | 
			
		||||
            step.activeDialog.state.authenticatorClientSecret
 | 
			
		||||
            step.activeDialog.state.authenticatorAuthorityHostUrl
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
          const locale = step.context.activity.locale;
 | 
			
		||||
| 
						 | 
				
			
			@ -253,7 +237,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.marketplaceId}&response_type=code&redirect_uri=${urlJoin(
 | 
			
		||||
              min.instance.botEndpoint,
 | 
			
		||||
              min.instance.botId,
 | 
			
		||||
              '/token'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,17 +133,13 @@ export class GBAdminService implements IGBAdminService {
 | 
			
		|||
  public async updateSecurityInfo(
 | 
			
		||||
    instanceId: number,
 | 
			
		||||
    authenticatorTenant: string,
 | 
			
		||||
    authenticatorAuthorityHostUrl: string,
 | 
			
		||||
    authenticatorClientId: string,
 | 
			
		||||
    authenticatorClientSecret: string
 | 
			
		||||
    authenticatorAuthorityHostUrl: string
 | 
			
		||||
  ): Promise<IGBInstance> {
 | 
			
		||||
    const options = { where: {} };
 | 
			
		||||
    options.where = { instanceId: instanceId };
 | 
			
		||||
    const item = await GuaribasInstance.findOne(options);
 | 
			
		||||
    item.authenticatorTenant = authenticatorTenant;
 | 
			
		||||
    item.authenticatorAuthorityHostUrl = authenticatorAuthorityHostUrl;
 | 
			
		||||
    item.authenticatorClientId = authenticatorClientId;
 | 
			
		||||
    item.authenticatorClientSecret = authenticatorClientSecret;
 | 
			
		||||
 | 
			
		||||
    return item.save();
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -182,8 +178,8 @@ export class GBAdminService implements IGBAdminService {
 | 
			
		|||
        const authenticationContext = new AuthenticationContext(authorizationUrl);
 | 
			
		||||
        authenticationContext.acquireTokenWithRefreshToken(
 | 
			
		||||
          refreshToken,
 | 
			
		||||
          instance.authenticatorClientId,
 | 
			
		||||
          instance.authenticatorClientSecret,
 | 
			
		||||
          instance.marketplaceId,
 | 
			
		||||
          instance.marketplacePassword,
 | 
			
		||||
          resource,
 | 
			
		||||
          async (err, res) => {
 | 
			
		||||
            if (err !== null) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,12 +108,6 @@ export class GuaribasInstance extends Model<GuaribasInstance>
 | 
			
		|||
  @Column
 | 
			
		||||
  public authenticatorAuthorityHostUrl: string;
 | 
			
		||||
 | 
			
		||||
  @Column
 | 
			
		||||
  public authenticatorClientId: string;
 | 
			
		||||
 | 
			
		||||
  @Column
 | 
			
		||||
  public authenticatorClientSecret: string;
 | 
			
		||||
 | 
			
		||||
  @Column
 | 
			
		||||
  public cloudSubscriptionId: string;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -157,7 +157,8 @@ class SysClass {
 | 
			
		|||
      }
 | 
			
		||||
    });
 | 
			
		||||
    const botId = this.min.instance.botId;
 | 
			
		||||
    const path = `/${botId}/${botId}.gbdata`;
 | 
			
		||||
 | 
			
		||||
    const path = `/${botId}.gbai/${botId}.gbdata`;
 | 
			
		||||
 | 
			
		||||
    let res = await client.api(
 | 
			
		||||
      `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(
 | 
			
		||||
      `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/items/${document[0].id}/workbook/createSession`)
 | 
			
		||||
      .get(body);
 | 
			
		||||
      .post(body);
 | 
			
		||||
 | 
			
		||||
    // 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`)
 | 
			
		||||
      .headers("workbook-session-id", session.session_Id)
 | 
			
		||||
      .get(bodyFilter);
 | 
			
		||||
 | 
			
		||||
      .headers("workbook-session-id", session.id)
 | 
			
		||||
      .post(bodyFilter);
 | 
			
		||||
 | 
			
		||||
    // Get the filtered values.
 | 
			
		||||
 | 
			
		||||
    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`)
 | 
			
		||||
      .headers("workbook-session-id", session.session_Id)
 | 
			
		||||
      .get(bodyFilter);
 | 
			
		||||
      .headers("workbook-session-id", session.id)
 | 
			
		||||
      .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() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -433,7 +433,7 @@ STORAGE_SYNC=true
 | 
			
		|||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  public async createBootInstance(
 | 
			
		||||
    core: GBCoreService,
 | 
			
		||||
    installationDeployer: IGBInstallationDeployer,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,7 +210,6 @@ export class GBMinService {
 | 
			
		|||
    const { min, adapter, conversationState } = await this.buildBotAdapter(instance, GBServer.globals.sysPackages);
 | 
			
		||||
    GBServer.globals.minInstances.push(min);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    this.deployer.deployPackage(min, 'packages/default.gbdialog');
 | 
			
		||||
 | 
			
		||||
    // Install per bot deployed packages.
 | 
			
		||||
| 
						 | 
				
			
			@ -299,8 +298,8 @@ export class GBMinService {
 | 
			
		|||
        req.query.code,
 | 
			
		||||
        urlJoin(instance.botEndpoint, min.instance.botId, '/token'),
 | 
			
		||||
        resource,
 | 
			
		||||
        instance.authenticatorClientId,
 | 
			
		||||
        instance.authenticatorClientSecret,
 | 
			
		||||
        instance.marketplaceId,
 | 
			
		||||
        instance.marketplacePassword,
 | 
			
		||||
        async (err, token) => {
 | 
			
		||||
          if (err) {
 | 
			
		||||
            const msg = `Error acquiring token: ${err}`;
 | 
			
		||||
| 
						 | 
				
			
			@ -326,7 +325,7 @@ export class GBMinService {
 | 
			
		|||
        '/oauth2/authorize'
 | 
			
		||||
      );
 | 
			
		||||
      authorizationUrl = `${authorizationUrl}?response_type=code&client_id=${
 | 
			
		||||
        min.instance.authenticatorClientId
 | 
			
		||||
        min.instance.marketplaceId
 | 
			
		||||
        }&redirect_uri=${urlJoin(min.instance.botEndpoint, min.instance.botId, 'token')}`;
 | 
			
		||||
      res.redirect(authorizationUrl);
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			@ -357,7 +356,7 @@ export class GBMinService {
 | 
			
		|||
          speechToken: speechToken,
 | 
			
		||||
          conversationId: webchatTokenContainer.conversationId,
 | 
			
		||||
          authenticatorTenant: instance.authenticatorTenant,
 | 
			
		||||
          authenticatorClientId: instance.authenticatorClientId
 | 
			
		||||
          authenticatorClientId: instance.marketplaceId
 | 
			
		||||
        })
 | 
			
		||||
      );
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -262,9 +262,7 @@ export class GBVMService extends GBService {
 | 
			
		|||
        GBLog.info(`[GBVMService] Finished loading of ${filename}`);
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        GBLog.error(`[GBVMService] ERROR loading ${error}`);
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,4 +18,33 @@ else
 | 
			
		|||
    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 { GBImporter } from '../packages/core.gbapp/services/GBImporterService';
 | 
			
		||||
import { GBMinService } from '../packages/core.gbapp/services/GBMinService';
 | 
			
		||||
import { GBWhatsappPackage } from '../packages/whatsapp.gblib';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Global shared server data;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue