mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: update cleanup service methods description
This commit is contained in:
parent
d73e4dc8cb
commit
7a30c363fd
@ -25,6 +25,14 @@ export class CleanupService {
|
|||||||
private readonly channelService: ChannelService,
|
private readonly channelService: ChannelService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes unused settings with the specified criteria.
|
||||||
|
*
|
||||||
|
* @param criteria - An array of criteria objects containing:
|
||||||
|
* - suffix: Regex pattern to match setting groups
|
||||||
|
* - namespaces: Array of namespaces to exclude from deletion
|
||||||
|
* @returns A promise that resolves to the result of the deletion operation.
|
||||||
|
*/
|
||||||
private async deleteManyBySuffixAndNamespaces(
|
private async deleteManyBySuffixAndNamespaces(
|
||||||
criteria: TCriteria[],
|
criteria: TCriteria[],
|
||||||
): Promise<DeleteResult> {
|
): Promise<DeleteResult> {
|
||||||
@ -35,19 +43,33 @@ export class CleanupService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of channel Namespaces.
|
||||||
|
*
|
||||||
|
* @returns An array of channel Namespaces.
|
||||||
|
*/
|
||||||
public getChannelNamespaces(): TExtractNamespace<'channel'>[] {
|
public getChannelNamespaces(): TExtractNamespace<'channel'>[] {
|
||||||
return this.channelService
|
return this.channelService
|
||||||
.getAll()
|
.getAll()
|
||||||
.map((channel) => channel.getNamespace<TExtractExtension<'channel'>>());
|
.map((channel) => channel.getNamespace<TExtractExtension<'channel'>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of helper Namespaces.
|
||||||
|
*
|
||||||
|
* @returns An array of helper Namespaces.
|
||||||
|
*/
|
||||||
public getHelperNamespaces(): TExtractNamespace<'helper'>[] {
|
public getHelperNamespaces(): TExtractNamespace<'helper'>[] {
|
||||||
return this.helperService
|
return this.helperService
|
||||||
.getAll()
|
.getAll()
|
||||||
.map((helper) => helper.getNamespace<TExtractExtension<'helper'>>());
|
.map((helper) => helper.getNamespace<TExtractExtension<'helper'>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async pruneExtensionSettings() {
|
/**
|
||||||
|
* Prune extensions unused settings.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public async pruneExtensionSettings(): Promise<void> {
|
||||||
const channels = this.getChannelNamespaces();
|
const channels = this.getChannelNamespaces();
|
||||||
const helpers = this.getHelperNamespaces();
|
const helpers = this.getHelperNamespaces();
|
||||||
const { deletedCount } = await this.deleteManyBySuffixAndNamespaces([
|
const { deletedCount } = await this.deleteManyBySuffixAndNamespaces([
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user