new(basic.gblib): GBDIALOG_GBDATABOT introduced to share a .gbdata among dev. team.

This commit is contained in:
rodrigorodriguez 2023-03-09 09:49:37 -03:00
parent a679786217
commit 335120f1d7
3 changed files with 15 additions and 9 deletions

View file

@ -783,7 +783,7 @@ export class DialogKeywords {
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min); let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min);
const botId = min.instance.botId; const botId = min.instance.botId;
const path = urljoin(`${botId}.gbai`, `${botId}.gbdata`); const path = DialogKeywords.getGBDataPath(botId);
let url = `${baseUrl}/drive/root:/${path}:/children`; let url = `${baseUrl}/drive/root:/${path}:/children`;
GBLog.info(`Loading HEAR AS .xlsx options from Sheet: ${url}`); GBLog.info(`Loading HEAR AS .xlsx options from Sheet: ${url}`);
@ -1028,6 +1028,12 @@ export class DialogKeywords {
GBLog.error(`BASIC RUNTIME ERR HEAR ${error.message ? error.message : error}\n Stack:${error.stack}`); GBLog.error(`BASIC RUNTIME ERR HEAR ${error.message ? error.message : error}\n Stack:${error.stack}`);
} }
} }
static getGBDataPath(botId) {
return GBConfigService.get('GBDIALOG_GBDATABOT')?
GBConfigService.get('GBDIALOG_GBDATABOT'):
urljoin(`${botId}.gbai`, `${botId}.gbdata`);
}
/** /**
* Prepares the next dialog to be shown to the specified user. * Prepares the next dialog to be shown to the specified user.

View file

@ -489,7 +489,7 @@ export class SystemKeywords {
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min); let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min);
const botId = min.instance.botId; const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbdata`; const path = DialogKeywords.getGBDataPath(botId);
address = address.indexOf(':') !== -1 ? address : address + ':' + address; address = address.indexOf(':') !== -1 ? address : address + ':' + address;
@ -569,7 +569,7 @@ export class SystemKeywords {
GBLog.info(`BASIC: Saving '${file}' (SAVE). Args: ${args.join(',')}.`); GBLog.info(`BASIC: Saving '${file}' (SAVE). Args: ${args.join(',')}.`);
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min); let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min);
const botId = min.instance.botId; const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbdata`; const path = DialogKeywords.getGBDataPath(botId);
let document = await this.internalGetDocument(client, baseUrl, path, file); let document = await this.internalGetDocument(client, baseUrl, path, file);
let sheets = await client.api(`${baseUrl}/drive/items/${document.id}/workbook/worksheets`).get(); let sheets = await client.api(`${baseUrl}/drive/items/${document.id}/workbook/worksheets`).get();
@ -623,7 +623,7 @@ export class SystemKeywords {
GBLog.info(`BASIC: GET '${addressOrHeaders}' in '${file}'.`); GBLog.info(`BASIC: GET '${addressOrHeaders}' in '${file}'.`);
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min); let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min);
const botId = min.instance.botId; const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbdata`; const path = DialogKeywords.getGBDataPath(botId);
let document = await this.internalGetDocument(client, baseUrl, path, file); let document = await this.internalGetDocument(client, baseUrl, path, file);
@ -695,7 +695,7 @@ export class SystemKeywords {
args.shift(); args.shift();
const botId = min.instance.botId; const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbdata`; const path = DialogKeywords.getGBDataPath(botId);
// MAX LINES property. // MAX LINES property.
@ -1188,9 +1188,9 @@ export class SystemKeywords {
// Determines full path at source and destination. // Determines full path at source and destination.
const root = urlJoin(`/${botId}.gbai/${botId}.gbdata`); const root = DialogKeywords.getGBDataPath(botId);
const srcPath = urlJoin(root, src); const srcPath = urlJoin(root, src);
const dstPath = urlJoin(`/${botId}.gbai/${botId}.gbdata`, dest); const dstPath = urlJoin(root, dest);
// Checks if the destination contains subfolders that // Checks if the destination contains subfolders that
// need to be created. // need to be created.
@ -1599,7 +1599,7 @@ export class SystemKeywords {
const { min, user, params } = await DialogKeywords.getProcessInfo(pid); const { min, user, params } = await DialogKeywords.getProcessInfo(pid);
const botId = min.instance.botId; const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbdata`; const path = DialogKeywords.getGBDataPath(botId);
// MAX LINES property. // MAX LINES property.

View file

@ -845,7 +845,7 @@ export class GBDeployer implements IGBDeployer {
); );
GBServer.globals.server.use(`/${botId}/cache`, express.static(urlJoin('work', gbaiName, 'cache'))); GBServer.globals.server.use(`/${botId}/cache`, express.static(urlJoin('work', gbaiName, 'cache')));
GBServer.globals.server.use( GBServer.globals.server.use(
`/${gbaiName}/${botId}.gbdata/public`, `/${gbaiName}/${botId}.gbdrive/public`,
express.static(urlJoin('work', gbaiName, `${botId}.gbdata`, 'public')) express.static(urlJoin('work', gbaiName, `${botId}.gbdata`, 'public'))
); );