new(basic.gblib): SET PAGED keyword #377.

This commit is contained in:
Rodrigo Rodriguez 2023-10-04 09:48:54 -03:00
parent 1a3a6e0d01
commit dbe430c623
3 changed files with 80 additions and 10 deletions

View file

@ -267,7 +267,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
public async updateBotProxy(botId: string, group: string, endpoint: string) {
if (!await this.botExists(botId)) {
GBLog.error(`Bot ${botId} does not exist on cloud.`);
GBLog.error(`Bot ${botId} does not exist on cloud.`);
return;
}
@ -367,13 +367,13 @@ export class AzureDeployerService implements IGBInstallationDeployer {
credentials,
subscriptionId);
}
public async deployFarm2(
proxyAddress: string,
instance: IGBInstance,
credentials: any,
subscriptionId: string
){
) {
const culture = 'en-us';
const token = credentials['tokenCache']._entries[0];
@ -390,6 +390,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
await this.enableResourceProviders('Microsoft.CognitiveServices');
await this.enableResourceProviders('Microsoft.BotService');
await this.enableResourceProviders('Microsoft.Search');
await this.enableResourceProviders('Microsoft.Web');
await this.enableResourceProviders('Microsoft.Sql');
@ -398,12 +399,13 @@ export class AzureDeployerService implements IGBInstallationDeployer {
let serverFarm;
let serverName;
if (process.env.DEPLOY_WEB){
if (process.env.DEPLOY_WEB) {
GBLog.info(`Deploying Bot Server...`);
serverFarm = await this.createHostingPlan(name, `${name}-server-plan`, instance.cloudLocation);
serverName = `${name}-server`;
await this.createServer(serverFarm.id, name, serverName, instance.cloudLocation);
};
}
GBLog.info(`Deploying Bot Storage...`);
const administratorLogin = `sa${GBAdminService.getRndReadableIdentifier()}`;
@ -492,7 +494,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
// const nlpAppId = await this.createNLPService(name, name, instance.cloudLocation, culture, instance.nlpAuthoringKey);
// instance.nlpAppId = nlpAppId;
if (process.env.DEPLOY_WEB){
if (process.env.DEPLOY_WEB) {
GBLog.info('Updating server environment variables...');
await this.updateWebisteConfig(name, serverName, serverFarm.id, instance);
}

View file

@ -1,11 +1,11 @@
/*****************************************************************************\
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| _ _ _ __ _ _ __ __ __ _ _ | ,_)(_) __ __ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' v `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__,\| (˅) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(___/(_) (_)`\__/' |
| | | ( )_) | |
| (_) \___/' |
| (_) \__/' |
| |
| General Bots Copyright (c) Pragmatismo.io. All rights reserved. |
| Licensed under the AGPL-3.0. |
@ -320,13 +320,78 @@ export class KeywordsExpressions {
}
];
keywords[i++] = [
/^\s*(set hear on)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
return `hrOn = ${$3}`;
}
];
keywords[i++] = [/^\s*for each +(.*to.*)/gim, 'for ($1) {'];
keywords[i++] = [
/^\s*FOR EACH\s*(.*)\s*IN\s*(.*)/gim,
($0, $1, $2) => {
return `
__totalCalls = 10; // TODO: global from Config.
__next = true;
__calls = 0;
__index = 0;
__url = $2.links?.next?.uri;
__seekToken = $2.links?.self?.headers["MS-ContinuationToken"]
__totalCount = $2["totalCount"];
while (__next)
{
let $1 = $2[__index];
`;
}
];
keywords[i++] = [
/^\s*END FOR\s*/gim,
($0, $1, $2) => {
return `
// TRUE if all items are processed.
if (__index >= __totalCount) {
// Check if HTTP call limit has reached.
if (__calls < __totalCalls) {
// Perform GET request using the constructed URL
$2 = await sys.get ({pid: pid, file: __url, addressOrHeaders: headers, httpUsername, httpPs});
// Update current variable handlers.
__url = $2.links?.next?.uri;
__seekToken = $2.links?.self?.headers["MS-ContinuationToken"]
__totalCount = $2["totalCount"];
index = 0;
__calls++;
} else {
next = false;
}
index = index + 1;
}
`;
}
];
keywords[i++] = [
/^\s*(.*)\=\s*(REWRITE)(\s*)(.*)/gim,
($0, $1, $2, $3, $4) => {

View file

@ -215,8 +215,11 @@ export class GBServer {
'packages/boot.gbot',
GBServer.globals.bootInstance
);
await deployer.deployBotFull(instance, GBServer.globals.publicAddress);
instances.push(instance);
GBServer.globals.minBoot
GBServer.globals.bootInstance = instances[0];
await deployer.deployBotFull(instance, GBServer.globals.publicAddress);
// Runs the search even with empty content to create structure.