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:
@@ -13,11 +13,7 @@
|
||||
|
||||
import { ElasticsearchConnectionManager } from '../../core/connection/connection-manager.js';
|
||||
import { Logger, defaultLogger } from '../../core/observability/logger.js';
|
||||
import {
|
||||
MetricsCollector,
|
||||
defaultMetricsCollector,
|
||||
} from '../../core/observability/metrics.js';
|
||||
import { DocumentNotFoundError } from '../../core/errors/index.js';
|
||||
import { MetricsCollector, defaultMetricsCollector } from '../../core/observability/metrics.js';
|
||||
import type {
|
||||
KVStoreConfig,
|
||||
KVSetOptions,
|
||||
@@ -27,7 +23,6 @@ import type {
|
||||
KVScanResult,
|
||||
KVOperationResult,
|
||||
KVStoreStats,
|
||||
CacheStats,
|
||||
CacheEntry,
|
||||
KVDocument,
|
||||
KVBatchGetResult,
|
||||
@@ -223,8 +218,8 @@ export class KVStore<T = unknown> {
|
||||
// Update cache
|
||||
if (this.config.enableCache && !options.skipCache) {
|
||||
this.cacheSet(key, value, {
|
||||
seqNo: result._seq_no,
|
||||
primaryTerm: result._primary_term,
|
||||
seqNo: result._seq_no ?? 0,
|
||||
primaryTerm: result._primary_term ?? 0,
|
||||
}, ttl);
|
||||
}
|
||||
|
||||
@@ -236,7 +231,7 @@ export class KVStore<T = unknown> {
|
||||
|
||||
this.metrics.recordCounter('kv.set', 1, {
|
||||
index: this.config.index,
|
||||
cached: !options.skipCache,
|
||||
cached: options.skipCache ? 'no' : 'yes',
|
||||
});
|
||||
this.metrics.recordHistogram('kv.set.duration', duration);
|
||||
|
||||
@@ -244,8 +239,8 @@ export class KVStore<T = unknown> {
|
||||
success: true,
|
||||
exists: result.result === 'updated',
|
||||
version: {
|
||||
seqNo: result._seq_no,
|
||||
primaryTerm: result._primary_term,
|
||||
seqNo: result._seq_no ?? 0,
|
||||
primaryTerm: result._primary_term ?? 0,
|
||||
},
|
||||
expiresAt: expiresAt ?? undefined,
|
||||
};
|
||||
@@ -281,7 +276,7 @@ export class KVStore<T = unknown> {
|
||||
|
||||
this.metrics.recordCounter('kv.get', 1, {
|
||||
index: this.config.index,
|
||||
cache_hit: true,
|
||||
cache_hit: 'true',
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -353,8 +348,8 @@ export class KVStore<T = unknown> {
|
||||
: undefined;
|
||||
|
||||
this.cacheSet(key, value, {
|
||||
seqNo: result._seq_no!,
|
||||
primaryTerm: result._primary_term!,
|
||||
seqNo: result._seq_no ?? 0,
|
||||
primaryTerm: result._primary_term ?? 0,
|
||||
}, ttl);
|
||||
}
|
||||
|
||||
@@ -366,7 +361,7 @@ export class KVStore<T = unknown> {
|
||||
|
||||
this.metrics.recordCounter('kv.get', 1, {
|
||||
index: this.config.index,
|
||||
cache_hit: false,
|
||||
cache_hit: 'false',
|
||||
});
|
||||
this.metrics.recordHistogram('kv.get.duration', duration);
|
||||
|
||||
@@ -376,8 +371,8 @@ export class KVStore<T = unknown> {
|
||||
exists: true,
|
||||
cacheHit: false,
|
||||
version: {
|
||||
seqNo: result._seq_no!,
|
||||
primaryTerm: result._primary_term!,
|
||||
seqNo: result._seq_no ?? 0,
|
||||
primaryTerm: result._primary_term ?? 0,
|
||||
},
|
||||
expiresAt: doc.expiresAt ? new Date(doc.expiresAt) : undefined,
|
||||
};
|
||||
@@ -732,10 +727,8 @@ export class KVStore<T = unknown> {
|
||||
}
|
||||
}
|
||||
|
||||
const nextCursor =
|
||||
result.hits.hits.length > 0
|
||||
? result.hits.hits[result.hits.hits.length - 1].sort?.[0] as string
|
||||
: undefined;
|
||||
const lastHit = result.hits.hits[result.hits.hits.length - 1];
|
||||
const nextCursor = lastHit?.sort?.[0] as string | undefined;
|
||||
|
||||
this.metrics.recordCounter('kv.scan', 1, {
|
||||
index: this.config.index,
|
||||
|
||||
Reference in New Issue
Block a user