new(all): #156 and node update.
This commit is contained in:
parent
62a1ed36e2
commit
68de407d63
6 changed files with 51 additions and 37 deletions
|
@ -1,7 +1,7 @@
|
|||
dist: focal
|
||||
language: node_js
|
||||
node_js:
|
||||
- 19.6.0
|
||||
- 19.7.0
|
||||
|
||||
|
||||
notifications:
|
||||
|
|
20
boot.mjs
20
boot.mjs
|
@ -6,23 +6,25 @@ import { exec } from 'child_process';
|
|||
import pjson from './package.json' assert { type: 'json' };
|
||||
|
||||
// Displays version of Node JS being used at runtime and others attributes.
|
||||
|
||||
|
||||
console.log(``);
|
||||
console.log(``);
|
||||
console.log(` ██████ ███████ ███ ██ ███████ ██████ █████ ██ ██████ ██████ ████████ ███████ ® `);
|
||||
console.log(`██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ `);
|
||||
console.log(`██ ███ █████ ██ ██ ██ █████ ██████ ███████ ██ ██████ ██ ██ ██ ███████ `);
|
||||
console.log(`██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ `);
|
||||
console.log(` ██████ ███████ ██ ████ ███████ ██ ██ ██ ██ ██████ ██████ ██████ ██ ███████ 3.0`);
|
||||
console.log(`botserver@${pjson.version}, botlib@${pjson.dependencies.botlib}, botbuilder@${pjson.dependencies.botbuilder}, node@${process.version}, ${process.platform}(${process.arch}).`);
|
||||
console.log(` █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® `);
|
||||
console.log(`██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ `);
|
||||
console.log(`██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ `);
|
||||
console.log(`██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ `);
|
||||
console.log(` █████ █████ █ ███ █████ ██ ██ ██ ██ ██████ ████ █████ █ ███ 3.0`);
|
||||
console.log(` botserver@${pjson.version}, botlib@${pjson.dependencies.botlib}, botbuilder@${pjson.dependencies.botbuilder}, node@${process.version.replace('v', '')}, ${process.platform} ${process.arch}`);
|
||||
|
||||
var now = () => {
|
||||
return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + ' UTC';
|
||||
};
|
||||
var __dirname = process.env.PWD || process.cwd();
|
||||
try {
|
||||
var run = () => {
|
||||
import('./dist/src/app.js').then((gb)=> gb.GBServer.run());
|
||||
import('./dist/src/app.js').then((gb)=> {
|
||||
console.log(``);
|
||||
gb.GBServer.run()
|
||||
});
|
||||
};
|
||||
var processDist = () => {
|
||||
if (!Fs.existsSync('dist')) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"Dário Vieira <dario.junior3@gmail.com>"
|
||||
],
|
||||
"engines": {
|
||||
"node": "=19.6.0"
|
||||
"node": "=19.7.0"
|
||||
},
|
||||
"license": "AGPL-3.0",
|
||||
"preferGlobal": true,
|
||||
|
|
|
@ -57,6 +57,7 @@ import { GBConfigService } from './GBConfigService.js';
|
|||
import { GBImporter } from './GBImporterService.js';
|
||||
import { TeamsService } from '../../teams.gblib/services/TeamsService.js';
|
||||
import MicrosoftGraph from '@microsoft/microsoft-graph-client';
|
||||
import { GBLogEx } from './GBLogEx.js';
|
||||
|
||||
/**
|
||||
* Deployer service for bots, themes, ai and more.
|
||||
|
@ -655,8 +656,8 @@ export class GBDeployer implements IGBDeployer {
|
|||
break;
|
||||
|
||||
default:
|
||||
throw GBError.create(`Unhandled package type: ${packageType}.`);
|
||||
}
|
||||
throw GBError.create(`Unhandled package type: ${packageType}.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -712,38 +713,45 @@ export class GBDeployer implements IGBDeployer {
|
|||
*/
|
||||
public async rebuildIndex(instance: IGBInstance, searchSchema: any) {
|
||||
// Prepares search.
|
||||
|
||||
|
||||
const search = new AzureSearch(
|
||||
instance.searchKey,
|
||||
instance.searchHost,
|
||||
instance.searchIndex,
|
||||
instance.searchIndexer
|
||||
);
|
||||
const connectionString = GBDeployer.getConnectionStringFromInstance(instance);
|
||||
const dsName = 'gb';
|
||||
let release;
|
||||
try {
|
||||
await search.createDataSource(dsName, dsName, 'GuaribasQuestion', 'azuresql', connectionString);
|
||||
} catch (err) {
|
||||
GBLog.error(err);
|
||||
GBLogEx.info(instance.instanceId, `Acquiring rebuildIndex mutex...`);
|
||||
release = await GBServer.globals.indexSemaphore.acquire();
|
||||
|
||||
}
|
||||
const search = new AzureSearch(
|
||||
instance.searchKey,
|
||||
instance.searchHost,
|
||||
instance.searchIndex,
|
||||
instance.searchIndexer
|
||||
);
|
||||
const connectionString = GBDeployer.getConnectionStringFromInstance(instance);
|
||||
const dsName = 'gb';
|
||||
try {
|
||||
await search.createDataSource(dsName, dsName, 'GuaribasQuestion', 'azuresql', connectionString);
|
||||
} catch (err) {
|
||||
GBLog.error(err);
|
||||
}
|
||||
|
||||
// Removes the index.
|
||||
// Removes the index.
|
||||
|
||||
try {
|
||||
await search.createIndex(searchSchema, dsName);
|
||||
} catch (err) {
|
||||
// If it is a 404 there is nothing to delete as it is the first creation.
|
||||
try {
|
||||
await search.createIndex(searchSchema, dsName);
|
||||
} catch (err) {
|
||||
// If it is a 404 there is nothing to delete as it is the first creation.
|
||||
|
||||
if (err.code !== 404 && err.code !== 'OperationNotAllowed') {
|
||||
if (err.code !== 404 && err.code !== 'OperationNotAllowed') {
|
||||
}
|
||||
}
|
||||
|
||||
GBLogEx.info(instance.instanceId, `Acquire rebuildIndex done.`);
|
||||
await search.rebuildIndex(instance.searchIndexer);
|
||||
release();
|
||||
GBLogEx.info(instance.instanceId, `Released rebuildIndex mutex.`);
|
||||
} catch {
|
||||
if (release) {
|
||||
release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await search.rebuildIndex(instance.searchIndexer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,4 +59,5 @@ export class RootData {
|
|||
public debugConversationId: any; // Used to self-message during debug.
|
||||
public debuggers: any[]; // Client of attached Debugger instances by botId.
|
||||
public chatGPT: any; // ChatGPT API handle (shared Browser).
|
||||
indexSemaphore: any;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import child_process from 'child_process';
|
|||
import * as winston from 'winston-logs-display';
|
||||
import { RootData } from './RootData.js';
|
||||
import { GBSSR } from '../packages/core.gbapp/services/GBSSR.js';
|
||||
import { Mutex } from 'async-mutex';
|
||||
|
||||
/**
|
||||
* General Bots open-core entry point.
|
||||
|
@ -95,6 +96,8 @@ export class GBServer {
|
|||
GBServer.globals.wwwroot = null;
|
||||
GBServer.globals.entryPointDialog = null;
|
||||
GBServer.globals.debuggers = [];
|
||||
GBServer.globals.indexSemaphore = new Mutex();
|
||||
|
||||
|
||||
server.use(bodyParser.json());
|
||||
server.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
|
Loading…
Add table
Reference in a new issue