fix(core): Resolve TypeScript strict mode and ES client API compatibility issues for v3.0.0
- Fix ES client v8+ API: use document/doc instead of body for index/update operations - Add type assertions (as any) for ES client ILM, template, and search APIs - Fix strict null checks with proper undefined handling (nullish coalescing) - Fix MetricsCollector interface to match required method signatures - Fix Logger.error signature compatibility in plugins - Resolve TermsQuery type index signature conflict - Remove sourceMap from tsconfig (handled by tsbuild with inlineSourceMap)
This commit is contained in:
@@ -63,7 +63,7 @@ export class PluginManager {
|
||||
try {
|
||||
await plugin.initialize(this.client, plugin.config || {});
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to initialize plugin '${plugin.name}'`, { error });
|
||||
this.logger.error(`Failed to initialize plugin '${plugin.name}'`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export class PluginManager {
|
||||
try {
|
||||
await plugin.destroy();
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to destroy plugin '${name}'`, { error });
|
||||
this.logger.error(`Failed to destroy plugin '${name}'`, error instanceof Error ? error : new Error(String(error)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,16 +186,15 @@ export class PluginManager {
|
||||
}
|
||||
|
||||
currentContext = result;
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Error in beforeRequest hook for plugin '${plugin.name}'`, {
|
||||
error,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error in beforeRequest hook for plugin '${plugin.name}'`, err);
|
||||
|
||||
if (this.config.collectStats) {
|
||||
const stats = this.pluginStats.get(plugin.name);
|
||||
if (stats) {
|
||||
stats.errors++;
|
||||
stats.lastError = error.message;
|
||||
stats.lastError = err.message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,16 +244,15 @@ export class PluginManager {
|
||||
});
|
||||
|
||||
currentResponse = result;
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Error in afterResponse hook for plugin '${plugin.name}'`, {
|
||||
error,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error in afterResponse hook for plugin '${plugin.name}'`, err);
|
||||
|
||||
if (this.config.collectStats) {
|
||||
const stats = this.pluginStats.get(plugin.name);
|
||||
if (stats) {
|
||||
stats.errors++;
|
||||
stats.lastError = error.message;
|
||||
stats.lastError = err.message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,14 +301,15 @@ export class PluginManager {
|
||||
this.logger.debug(`Error handled by plugin '${plugin.name}'`);
|
||||
return result;
|
||||
}
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Error in onError hook for plugin '${plugin.name}'`, { error });
|
||||
} catch (error: unknown) {
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error in onError hook for plugin '${plugin.name}'`, err);
|
||||
|
||||
if (this.config.collectStats) {
|
||||
const stats = this.pluginStats.get(plugin.name);
|
||||
if (stats) {
|
||||
stats.errors++;
|
||||
stats.lastError = error.message;
|
||||
stats.lastError = err.message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user