fix(ci): Update CI workflows and build config; bump dependencies; code style and TS config fixes

This commit is contained in:
2025-11-29 09:48:31 +00:00
parent 36d7cb69a3
commit 0701207acd
20 changed files with 7858 additions and 5194 deletions

View File

@@ -16,12 +16,14 @@ export class ElasticIndex {
return indexNameArg;
}
const responseArg = await this.elasticSearchRef.client.cat.indices({
format: 'json',
bytes: 'mb',
}).catch(err => {
console.log(err);
});
const responseArg = await this.elasticSearchRef.client.cat
.indices({
format: 'json',
bytes: 'mb',
})
.catch((err) => {
console.log(err);
});
if (!responseArg) {
throw new Error('Could not get valid response from elastic search');
@@ -57,19 +59,17 @@ export class ElasticIndex {
const response = await this.elasticSearchRef.client.indices.create({
wait_for_active_shards: 1,
index: indexNameArg,
body: {
mappings: {
properties: {
'@timestamp': {
type: 'date',
},
logPackageArg: {
properties: {
payload: {
type: 'object',
dynamic: true
}
}
mappings: {
properties: {
'@timestamp': {
type: 'date',
},
logPackageArg: {
properties: {
payload: {
type: 'object',
dynamic: true,
},
},
},
},
@@ -80,21 +80,24 @@ export class ElasticIndex {
public async deleteOldIndices(prefixArg: string, indicesArray: string[]) {
const todayAsUnix: number = Date.now();
const rententionPeriodAsUnix: number = plugins.smarttime.units.days(
this.elasticSearchRef.indexRetention
this.elasticSearchRef.indexRetention,
);
for (const indexName of indicesArray) {
if (!indexName.startsWith(prefixArg)) continue;
const indexRegex = new RegExp(`^${prefixArg}-([0-9]*)-([0-9]*)-([0-9]*)$`)
const indexRegex = new RegExp(
`^${prefixArg}-([0-9]*)-([0-9]*)-([0-9]*)$`,
);
const regexResult = indexRegex.exec(indexName);
const dateAsUnix: number = new Date(
`${regexResult[1]}-${regexResult[2]}-${regexResult[3]}`
`${regexResult[1]}-${regexResult[2]}-${regexResult[3]}`,
).getTime();
if (todayAsUnix - rententionPeriodAsUnix > dateAsUnix) {
console.log(`found old index ${indexName}`);
const response = await this.elasticSearchRef.client.indices.delete(
{
const response = await this.elasticSearchRef.client.indices
.delete({
index: indexName,
}).catch(err => {
})
.catch((err) => {
console.log(err);
});
}