fix(all): Libraries update.

This commit is contained in:
Rodrigo Rodriguez 2024-05-25 19:11:01 -03:00
parent 9a82d2de01
commit 2dcde51c95
15 changed files with 176 additions and 233 deletions

View file

@ -55,7 +55,7 @@
"jest": {
"workerIdleMemoryLimit": "4096MB",
"transform": {
"^.+\\.tsx?$": "ts-jest"
".+\\.tsx?$": "ts-jest"
},
"moduleFileExtensions": [
"ts",
@ -66,180 +66,180 @@
]
},
"dependencies": {
"@azure/arm-appservice": "13.0.3",
"@azure/arm-cognitiveservices": "7.3.1",
"@azure/arm-resources": "5.1.0",
"@azure/arm-search": "3.0.1",
"@azure/arm-sql": "9.0.1",
"@azure/arm-appservice": "14.1.0",
"@azure/arm-cognitiveservices": "7.5.0",
"@azure/arm-resources": "5.2.0",
"@azure/arm-search": "3.2.0",
"@azure/arm-sql": "10.0.0",
"@azure/arm-subscriptions": "5.1.0",
"@azure/cognitiveservices-computervision": "8.2.0",
"@azure/keyvault-keys": "4.6.0",
"@azure/ms-rest-js": "2.6.2",
"@azure/msal-node": "1.14.3",
"@azure/keyvault-keys": "4.8.0",
"@azure/ms-rest-js": "2.7.0",
"@azure/msal-node": "2.8.1",
"@azure/search-documents": "12.0.0",
"@azure/storage-blob": "12.17.0",
"@google-cloud/pubsub": "3.2.1",
"@google-cloud/translate": "7.0.4",
"@hubspot/api-client": "7.1.2",
"@koa/cors": "4.0.0",
"@langchain/community": "0.0.36",
"@azure/storage-blob": "12.18.0",
"@google-cloud/pubsub": "4.4.0",
"@google-cloud/translate": "8.3.0",
"@hubspot/api-client": "11.1.0",
"@koa/cors": "5.0.0",
"@langchain/community": "0.2.2",
"@langchain/openai": "0.0.33",
"@microsoft/microsoft-graph-client": "3.0.4",
"@nlpjs/basic": "4.26.1",
"@nosferatu500/textract": "3.1.2",
"@push-rpc/core": "1.8.2",
"@push-rpc/http": "1.8.2",
"@push-rpc/openapi": "^1.9.0",
"@push-rpc/websocket": "1.8.2",
"@semantic-release/changelog": "5.0.1",
"@semantic-release/exec": "5.0.0",
"@semantic-release/git": "9.0.0",
"@sendgrid/mail": "7.7.0",
"@sequelize/core": "7.0.0-alpha.29",
"@types/node": "18.11.9",
"@types/validator": "13.7.10",
"adm-zip": "0.5.9",
"alasql": "2.1.6",
"@microsoft/microsoft-graph-client": "3.0.7",
"@nlpjs/basic": "4.27.0",
"@nosferatu500/textract": "3.1.3",
"@push-rpc/core": "1.9.0",
"@push-rpc/http": "1.9.0",
"@push-rpc/openapi": "1.9.0",
"@push-rpc/websocket": "1.9.0",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@sendgrid/mail": "8.1.3",
"@sequelize/core": "7.0.0-alpha.37",
"@types/node": "20.12.12",
"@types/validator": "13.11.10",
"adm-zip": "0.5.12",
"alasql": "4.4.0",
"any-shell-escape": "0.1.1",
"arraybuffer-to-buffer": "0.0.7",
"async-mutex": "0.4.0",
"async-mutex": "0.5.0",
"async-promises": "0.2.3",
"async-retry": "1.3.3",
"basic-auth": "2.0.1",
"billboard.js": "3.6.3",
"billboard.js": "3.11.3",
"bluebird": "3.7.2",
"body-parser": "1.20.1",
"botbuilder": "4.18.0",
"botbuilder-adapter-facebook": "1.0.12",
"botbuilder-ai": "4.18.0",
"botbuilder-dialogs": "4.18.0",
"botframework-connector": "4.18.0",
"botframework-connector": "4.22.2",
"botlib": "3.0.11",
"c3-chart-maker": "0.2.8",
"cd": "^0.3.3",
"chalk-animation": "^2.0.3",
"chatgpt": "2.4.2",
"chrome-remote-interface": "0.31.3",
"cli-progress": "3.11.2",
"cd": "0.3.3",
"chalk-animation": "2.0.3",
"chatgpt": "5.2.5",
"chrome-remote-interface": "0.33.0",
"cli-progress": "3.12.0",
"cli-spinner": "0.2.10",
"core-js": "3.26.1",
"data-forge": "1.9.6",
"core-js": "3.37.1",
"data-forge": "1.10.2",
"date-diff": "1.0.2",
"docximager": "0.0.4",
"docxtemplater": "3.9.7",
"docxtemplater": "3.47.4",
"dotenv-extended": "2.9.0",
"dynamics-web-api": "1.7.6",
"exceljs": "4.3.0",
"express": "4.18.2",
"exceljs": "4.4.0",
"express": "4.19.2",
"express-remove-route": "1.0.0",
"ffmpeg-static": "5.1.0",
"get-image-colors": "^4.0.1",
"google-libphonenumber": "3.2.31",
"ffmpeg-static": "5.2.0",
"get-image-colors": "4.0.1",
"google-libphonenumber": "3.2.34",
"googleapis": "126.0.1",
"hnswlib-node": "^1.4.2",
"hnswlib-node": "3.0.0",
"http-proxy": "1.18.1",
"ibm-watson": "7.1.2",
"iso-639-1": "3.1.1",
"ibm-watson": "9.1.0",
"iso-639-1": "3.1.2",
"join-images-updated": "1.1.11",
"js-md5": "0.8.3",
"json-schema-to-zod": "^2.0.14",
"json-schema-to-zod": "2.1.0",
"just-indent": "0.0.1",
"keyv": "4.5.2",
"koa": "2.13.4",
"keyv": "4.5.4",
"koa": "2.15.3",
"koa-body": "6.0.1",
"koa-router": "12.0.0",
"langchain": "0.1.25",
"language-tags": "^1.0.9",
"koa-router": "12.0.1",
"langchain": "0.2.2",
"language-tags": "1.0.9",
"line-replace": "2.0.1",
"lodash": "4.17.21",
"lunary": "^0.6.16",
"luxon": "3.1.0",
"mammoth": "1.7.0",
"mariadb": "3.2.2",
"luxon": "3.4.4",
"mammoth": "1.7.2",
"mariadb": "3.3.0",
"mime-types": "2.1.35",
"moment": "1.3.0",
"ms-rest-azure": "3.0.0",
"moment": "2.30.1",
"ms-rest-azure": "3.0.2",
"nexmo": "2.9.1",
"ngrok": "5.0.0-beta.2",
"node-cron": "3.0.2",
"node-html-parser": "6.1.5",
"node-nlp": "4.26.1",
"node-cron": "3.0.3",
"node-html-parser": "6.1.13",
"node-nlp": "4.27.0",
"node-tesseract-ocr": "2.2.1",
"npm": "9.6.1",
"open": "8.4.0",
"npm": "10.8.0",
"open": "10.1.0",
"open-docxtemplater-image-module": "1.0.3",
"openai": "4.6.0",
"openai": "4.47.1",
"pdf-extraction": "1.0.2",
"pdf-parse": "1.1.1",
"pdf-to-png-converter": "3.2.0",
"pdfjs-dist": "4.0.379",
"pdfkit": "0.13.0",
"phone": "3.1.30",
"pizzip": "3.1.3",
"pdfjs-dist": "4.2.67",
"pdfkit": "0.15.0",
"phone": "3.1.44",
"pizzip": "3.1.7",
"pptxtemplater": "1.0.5",
"pragmatismo-io-framework": "1.1.1",
"prism-media": "1.3.4",
"public-ip": "6.0.1",
"punycode": "2.1.1",
"puppeteer": "19.8.0",
"puppeteer-extra": "3.3.4",
"prism-media": "1.3.5",
"public-ip": "6.0.2",
"punycode": "2.3.1",
"puppeteer": "19.7.2",
"puppeteer-extra": "3.3.6",
"puppeteer-extra-plugin-minmax": "1.1.2",
"puppeteer-extra-plugin-stealth": "2.11.1",
"puppeteer-extra-plugin-stealth": "2.11.2",
"qr-scanner": "1.4.2",
"qrcode": "1.5.1",
"qrcode": "1.5.3",
"qrcode-terminal": "0.12.0",
"readline": "1.3.0",
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"reflect-metadata": "0.2.2",
"rimraf": "5.0.7",
"safe-buffer": "5.2.1",
"scanf": "1.1.2",
"scanf": "1.2.0",
"sequelize": "6.28.2",
"sequelize-cli": "6.6.0",
"sequelize-typescript": "2.1.5",
"sharp": "0.33.4",
"simple-git": "3.16.0",
"simple-git": "3.24.0",
"speakingurl": "14.0.1",
"ssr-for-bots": "1.0.1-c",
"strict-password-generator": "1.1.2",
"swagger-client": "3.18.5",
"swagger-ui-dist": "^5.11.0",
"tabulator-tables": "5.4.2",
"tedious": "15.1.2",
"swagger-client": "3.28.1",
"swagger-ui-dist": "5.17.12",
"tabulator-tables": "6.2.1",
"tedious": "18.2.0",
"textract": "2.5.0",
"twilio": "^4.23.0",
"twitter-api-v2": "1.12.9",
"typescript": "4.9.5",
"twilio": "5.1.0",
"twitter-api-v2": "1.17.0",
"typescript": "5.4.5",
"url-join": "5.0.0",
"vhost": "3.0.2",
"vm2": "3.9.11",
"vm2-process": "2.1.1",
"vm2-process": "2.1.5",
"walk-promise": "0.2.0",
"washyourmouthoutwithsoap": "1.0.2",
"whatsapp-cloud-api": "0.3.1",
"whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7",
"winston": "3.8.2",
"ws": "8.14.2",
"winston": "3.13.0",
"ws": "8.17.0",
"yaml": "2.4.2",
"yarn": "1.22.19",
"zod-to-json-schema": "^3.22.4"
"yarn": "1.22.22",
"zod-to-json-schema": "3.23.0"
},
"devDependencies": {
"@types/qrcode": "1.5.0",
"@types/url-join": "4.0.1",
"ban-sensitive-files": "1.9.18",
"commitizen": "4.2.2",
"@types/qrcode": "1.5.5",
"@types/url-join": "4.0.3",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"ban-sensitive-files": "1.10.2",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"dependency-check": "4.1.0",
"git-issues": "1.0.0",
"git-issues": "1.3.1",
"license-checker": "25.0.1",
"prettier-standard": "15.0.1",
"semantic-release": "17.2.4",
"simple-commit-message": "4.0.13",
"prettier-standard": "16.4.1",
"semantic-release": "23.1.1",
"simple-commit-message": "4.1.3",
"super-strong-password-generator": "2.0.2",
"super-strong-password-generator-es": "2.0.2",
"travis-deploy-once": "5.0.11",
"tslint": "6.1.3",
"vitest": "^1.3.0"
"vitest": "1.6.0"
},
"optionalDependencies": {
"@img/sharp-linux-arm": "0.33.4",

View file

@ -52,8 +52,6 @@ import _ from 'lodash';
import { pdfToPng, PngPageOutput } from 'pdf-to-png-converter';
import sharp from 'sharp';
import ImageModule from 'open-docxtemplater-image-module';
import DynamicsWebApi from 'dynamics-web-api';
import * as MSAL from '@azure/msal-node';
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
import { WebAutomationServices } from './WebAutomationServices.js';
import { KeywordsExpressions } from './KeywordsExpressions.js';
@ -1906,59 +1904,6 @@ export class SystemKeywords {
return text.replace(/\D/gi, '');
}
//Create a CREAT LEAD keyword
public async createLead({ pid, templateName, data }) {
//OAuth Token Endpoint (from your Azure App Registration)
const authorityUrl = 'https://login.microsoftonline.com/<COPY A GUID HERE>';
const msalConfig = {
auth: {
authority: authorityUrl,
clientId: process.env.DYNAMICS_CLIENTID,
clientSecret: process.env.DYNAMICS_CLIENTSECRET,
knownAuthorities: ['login.microsoftonline.com']
}
};
const cca = new MSAL.ConfidentialClientApplication(msalConfig);
const serverUrl = ` `;
//function that acquires a token and passes it to DynamicsWebApi
const acquireToken = dynamicsWebApiCallback => {
cca
.acquireTokenByClientCredential({
scopes: [`${serverUrl}/.default`]
})
.then(response => {
//call DynamicsWebApi callback only when a token has been retrieved successfully
dynamicsWebApiCallback(response.accessToken);
})
.catch(error => {
console.log(JSON.stringify(error));
});
};
//create DynamicsWebApi
const dynamicsWebApi = new DynamicsWebApi({
webApiUrl: `${serverUrl}/api/data/v9.2/`,
onTokenRefresh: acquireToken
});
//initialize a CRM entity record object
var lead = {
subject: 'Test WebAPI',
firstname: 'Test',
lastname: 'WebAPI',
jobtitle: 'Title'
};
//call dynamicsWebApi.create function
dynamicsWebApi
.create(lead, 'leads')
.then(function (id) {
//do something with id here
})
.catch(function (error) {
//catch error here
});
}
/**
*
* Fills a .docx or .pptx with template data.

View file

@ -37,7 +37,7 @@
import Path from 'path';
import express from 'express';
import child_process from 'child_process';
import rimraf from 'rimraf';
import { rimraf } from 'rimraf';
import urlJoin from 'url-join';
import Fs from 'fs';
import { GBError, GBLog, GBMinInstance, IGBCoreService, IGBDeployer, IGBInstance, IGBPackage } from 'botlib';
@ -96,7 +96,11 @@ export class GBDeployer implements IGBDeployer {
* use to database like the Indexer (Azure Search).
*/
public static getConnectionStringFromInstance(instance: IGBInstance) {
return `Server=tcp:${GBConfigService.get("STORAGE_SERVER")},1433;Database=${GBConfigService.get("STORAGE_NAME")};User ID=${GBConfigService.get("STORAGE_USERNAME")};Password=${GBConfigService.get("STORAGE_PASSWORD")};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;`;
return `Server=tcp:${GBConfigService.get('STORAGE_SERVER')},1433;Database=${GBConfigService.get(
'STORAGE_NAME'
)};User ID=${GBConfigService.get('STORAGE_USERNAME')};Password=${GBConfigService.get(
'STORAGE_PASSWORD'
)};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;`;
}
/**
@ -108,8 +112,10 @@ export class GBDeployer implements IGBDeployer {
// Get token as root only if the bot does not have
// an custom tenant for retrieving packages.
token = await (min.adminService as any)['acquireElevatedToken']
(min.instance.instanceId, min.instance.authenticatorTenant ? false : true);
token = await (min.adminService as any)['acquireElevatedToken'](
min.instance.instanceId,
min.instance.authenticatorTenant ? false : true
);
const siteId = process.env.STORAGE_SITE_ID;
const libraryId = process.env.STORAGE_LIBRARY;
@ -123,7 +129,6 @@ export class GBDeployer implements IGBDeployer {
min['cacheToken'] = { baseUrl, client };
return { baseUrl, client };
}
/**
@ -233,7 +238,7 @@ export class GBDeployer implements IGBDeployer {
instance.marketplacePassword = await service.createApplicationSecret(accessToken, (application as any).id);
instance.adminPass = GBAdminService.getRndPassword();
instance.title = botId;
instance.activationCode = instance.botId.substring(0,15);
instance.activationCode = instance.botId.substring(0, 15);
instance.state = 'active';
instance.nlpScore = 0.8;
instance.searchScore = 0.25;
@ -267,7 +272,7 @@ export class GBDeployer implements IGBDeployer {
const username = GBConfigService.get('CLOUD_USERNAME');
const password = GBConfigService.get('CLOUD_PASSWORD');
const accessToken = await GBAdminService.getADALTokenFromUsername(username, password);
const group = GBConfigService.get('CLOUD_GROUP')??GBConfigService.get('BOT_ID');
const group = GBConfigService.get('CLOUD_GROUP') ?? GBConfigService.get('BOT_ID');
const subscriptionId = GBConfigService.get('CLOUD_SUBSCRIPTIONID');
// If the bot already exists, just update the endpoint.
@ -320,30 +325,30 @@ export class GBDeployer implements IGBDeployer {
const azureOpenAIEmbeddingModel = await min.core.getParam(min.instance, 'Azure Open AI Embedding Model', null);
let embedding;
if (azureOpenAIKey) {
embedding = new OpenAIEmbeddings({ maxConcurrency: 5,
if (!azureOpenAIEmbeddingModel) {
return;
}
embedding = new OpenAIEmbeddings({
maxConcurrency: 5,
azureOpenAIApiKey: azureOpenAIKey,
azureOpenAIApiDeploymentName: azureOpenAIEmbeddingModel,
azureOpenAIApiVersion: azureOpenAIVersion,
azureOpenAIApiInstanceName: azureOpenAIApiInstanceName
});
}else{
embedding = new OpenAIEmbeddings({ maxConcurrency: 5 })
}
try {
vectorStore = await HNSWLib.load(min['vectorStorePath'], embedding);
} catch {
vectorStore = new HNSWLib(embedding, {
space: 'cosine',
numDimensions: 1536,
numDimensions: 1536
});
}
return vectorStore;
}
/**
* Performs the NLP publishing process on remote service.
*/
@ -645,12 +650,12 @@ export class GBDeployer implements IGBDeployer {
const connectionName = t.replace(strFind, '');
let con = {};
con['name'] = connectionName;
con['storageServer'] = min.core.getParam<string>(min.instance, `${connectionName} Server`, null),
con['storageName'] = min.core.getParam<string>(min.instance, `${connectionName} Name`, null),
con['storageUsername'] = min.core.getParam<string>(min.instance, `${connectionName} Username`, null),
con['storagePort'] = min.core.getParam<string>(min.instance, `${connectionName} Port`, null),
con['storagePassword'] = min.core.getParam<string>(min.instance, `${connectionName} Password`, null),
con['storageDriver'] = min.core.getParam<string>(min.instance, `${connectionName} Driver`, null)
(con['storageServer'] = min.core.getParam<string>(min.instance, `${connectionName} Server`, null)),
(con['storageName'] = min.core.getParam<string>(min.instance, `${connectionName} Name`, null)),
(con['storageUsername'] = min.core.getParam<string>(min.instance, `${connectionName} Username`, null)),
(con['storagePort'] = min.core.getParam<string>(min.instance, `${connectionName} Port`, null)),
(con['storagePassword'] = min.core.getParam<string>(min.instance, `${connectionName} Password`, null)),
(con['storageDriver'] = min.core.getParam<string>(min.instance, `${connectionName} Driver`, null));
connections.push(con);
});
@ -785,12 +790,10 @@ export class GBDeployer implements IGBDeployer {
* its index based on .gbkb structure.
*/
public async rebuildIndex(instance: IGBInstance, searchSchema: any) {
const key = instance.searchKey ? instance.searchKey : GBServer.globals.minBoot.instance.searchKey;
GBLogEx.info(instance.instanceId, `rebuildIndex running...`);
if (!key){
if (!key) {
return;
}
const searchIndex = instance.searchIndex ? instance.searchIndex : GBServer.globals.minBoot.instance.searchIndex;
@ -801,12 +804,7 @@ export class GBDeployer implements IGBDeployer {
// Prepares search.
const search = new AzureSearch(
key,
host,
searchIndex,
searchIndexer
);
const search = new AzureSearch(key, host, searchIndex, searchIndexer);
const connectionString = GBDeployer.getConnectionStringFromInstance(GBServer.globals.minBoot.instance);
const dsName = 'gb';

View file

@ -286,7 +286,7 @@ export class ChatServices {
let model;
const azureOpenAIKey = await min.core.getParam(min.instance, 'Azure Open AI Key', null);
const azureOpenAIGPTModel = await min.core.getParam(min.instance, 'Azure Open GPT Model', null);
const azureOpenAIGPTModel = await min.core.getParam(min.instance, 'Azure Open AI GPT Model', null);
const azureOpenAIVersion = await min.core.getParam(min.instance, 'Azure Open AI Version', null);
const azureOpenAIApiInstanceName = await min.core.getParam(min.instance, 'Azure Open AI Instance', null);

View file

@ -43,10 +43,10 @@ import getSlug from 'speakingurl';
import { GBServer } from '../../../src/app.js';
import { JSONLoader } from 'langchain/document_loaders/fs/json';
import { TextLoader } from 'langchain/document_loaders/fs/text';
import { PDFLoader } from 'langchain/document_loaders/fs/pdf';
import { DocxLoader } from 'langchain/document_loaders/fs/docx';
import { EPubLoader } from 'langchain/document_loaders/fs/epub';
import { CSVLoader } from 'langchain/document_loaders/fs/csv';
import { PDFLoader } from '@langchain/community/document_loaders/fs/pdf';
import { DocxLoader } from '@langchain/community/document_loaders/fs/docx';
import { EPubLoader } from '@langchain/community/document_loaders/fs/epub';
import { CSVLoader } from '@langchain/community/document_loaders/fs/csv';
import path from 'path';
import puppeteer, { Page } from 'puppeteer';
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter';

View file

@ -106,7 +106,7 @@ export class GBServer {
server.use(bodyParser.json({ limit: '1mb' }));
server.use(bodyParser.urlencoded({ limit: '1mb', extended: true }));
server.use(function(req, res, next) {
for (var key in req.query)
for (const key in req.query)
{
req.query[key.toLowerCase()] = req.query[key];
}

View file

@ -38,8 +38,8 @@
export class GBUtil {
public static repeat (chr, count) {
var str = "";
for (var x = 0; x < count; x++) { str += chr };
let str = "";
for (let x = 0; x < count; x++) { str += chr };
return str;
}
@ -48,7 +48,7 @@ export class GBUtil {
return value;
if (!pad) pad = " ";
var length = width - value.length
const length = width - value.length
if (length < 1) return value.substr(0, width);
return (GBUtil.repeat(pad, length) + value).substr(0, width);
@ -58,7 +58,7 @@ export class GBUtil {
return value;
if (!pad) pad = " ";
var length = width - value.length
const length = width - value.length
if (length < 1) value.substr(0, width);
return (value + GBUtil.repeat(pad, length)).substr(0, width);

View file

@ -12,7 +12,7 @@
"mapRoot": "./dist/",
"moduleResolution": "Node",
"module": "ESNext",
"forceConsistentCasingInFileNames": true,
"forceConsistentCasingInFileNames": false,
"resolveJsonModule": true,
"outDir": "./dist",
"paths": {