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:
@@ -199,9 +199,26 @@ export class Logger {
|
||||
|
||||
/**
|
||||
* Log at ERROR level
|
||||
*
|
||||
* Accepts either:
|
||||
* - error(message, Error, meta) - explicit error with optional metadata
|
||||
* - error(message, meta) - error context as metadata (error property extracted)
|
||||
*/
|
||||
error(message: string, error?: Error, meta?: Record<string, unknown>): void {
|
||||
this.log(LogLevel.ERROR, message, meta, error);
|
||||
error(message: string, errorOrMeta?: Error | Record<string, unknown>, meta?: Record<string, unknown>): void {
|
||||
if (errorOrMeta instanceof Error) {
|
||||
this.log(LogLevel.ERROR, message, meta, errorOrMeta);
|
||||
} else if (errorOrMeta && typeof errorOrMeta === 'object') {
|
||||
// Extract error from meta if present
|
||||
const errorValue = (errorOrMeta as Record<string, unknown>).error;
|
||||
const extractedError = errorValue instanceof Error
|
||||
? errorValue
|
||||
: typeof errorValue === 'string'
|
||||
? new Error(errorValue)
|
||||
: undefined;
|
||||
this.log(LogLevel.ERROR, message, errorOrMeta, extractedError);
|
||||
} else {
|
||||
this.log(LogLevel.ERROR, message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user