mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 09:46:16 +00:00
feat: Simplify update process by removing deprecated methods and enhancing README; improve type safety in tests
This commit is contained in:
@@ -70,11 +70,10 @@ function stripJsonComments(input: string): string {
|
||||
|
||||
// Normalize both legacy (flat) and new (nested) config schemas into the flat Config interface
|
||||
function normalizeConfig(raw: unknown): Config {
|
||||
// TYPE SAFETY NOTE: Using `any` here is necessary for backwards compatibility
|
||||
// JUSTIFIED USE OF `any`: The config format has evolved from flat → nested structure over time
|
||||
// This needs to support BOTH formats for backward compatibility with existing user configs
|
||||
// Runtime validation happens through explicit property checks and the Config interface return type ensures type safety at function boundary
|
||||
// Alternative approaches (discriminated unions, conditional types) would require extensive runtime checks making code significantly more complex
|
||||
// TYPE SAFETY NOTE: Using `any` here is intentional and justified
|
||||
// Reason: Config format evolved from flat → nested structure. This function must support BOTH
|
||||
// for backward compatibility. Runtime validation via explicit checks ensures safety.
|
||||
// Return type (Config interface) provides type safety at function boundary.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const n = (raw || {}) as any
|
||||
|
||||
|
||||
@@ -49,6 +49,14 @@ if (typeof cleanupInterval.unref === 'function') {
|
||||
cleanupInterval.unref()
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the webhook buffer cleanup interval
|
||||
* Call this during graceful shutdown to prevent memory leaks
|
||||
*/
|
||||
export function stopWebhookCleanup(): void {
|
||||
clearInterval(cleanupInterval)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create a webhook buffer for the given URL
|
||||
* Buffers batch log messages to reduce Discord API calls
|
||||
|
||||
Reference in New Issue
Block a user