Skip to content

Commit 6170cf7

Browse files
authored
Merge pull request #542 from objectstack-ai/copilot/update-analytics-dashboard
2 parents a7984ec + 4b34cc3 commit 6170cf7

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

packages/core/src/security/security-scanner.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {
2-
SecurityVulnerability,
3-
SecurityScanResult
2+
KernelSecurityVulnerability,
3+
KernelSecurityScanResult
44
} from '@objectstack/spec/kernel';
55
import type { ObjectLogger } from '../logger.js';
66

@@ -42,10 +42,10 @@ export class PluginSecurityScanner {
4242
private logger: ObjectLogger;
4343

4444
// Known vulnerabilities database (CVE cache)
45-
private vulnerabilityDb = new Map<string, SecurityVulnerability>();
45+
private vulnerabilityDb = new Map<string, KernelSecurityVulnerability>();
4646

4747
// Scan results cache
48-
private scanResults = new Map<string, SecurityScanResult>();
48+
private scanResults = new Map<string, KernelSecurityScanResult>();
4949

5050
private passThreshold: number = 70;
5151

@@ -59,7 +59,7 @@ export class PluginSecurityScanner {
5959
/**
6060
* Perform a comprehensive security scan on a plugin
6161
*/
62-
async scan(target: ScanTarget): Promise<SecurityScanResult> {
62+
async scan(target: ScanTarget): Promise<KernelSecurityScanResult> {
6363
this.logger.info('Starting security scan', {
6464
pluginId: target.pluginId,
6565
version: target.version
@@ -91,7 +91,7 @@ export class PluginSecurityScanner {
9191
// Calculate security score (0-100, higher is better)
9292
const score = this.calculateSecurityScore(issues);
9393

94-
const result: SecurityScanResult = {
94+
const result: KernelSecurityScanResult = {
9595
timestamp: new Date().toISOString(),
9696
scanner: { name: 'ObjectStack Security Scanner', version: '1.0.0' },
9797
status: score >= this.passThreshold ? 'passed' : 'failed',
@@ -309,7 +309,7 @@ export class PluginSecurityScanner {
309309
addVulnerability(
310310
packageName: string,
311311
version: string,
312-
vulnerability: SecurityVulnerability
312+
vulnerability: KernelSecurityVulnerability
313313
): void {
314314
const key = `${packageName}@${version}`;
315315
this.vulnerabilityDb.set(key, vulnerability);
@@ -324,7 +324,7 @@ export class PluginSecurityScanner {
324324
/**
325325
* Get scan result from cache
326326
*/
327-
getScanResult(pluginId: string, version: string): SecurityScanResult | undefined {
327+
getScanResult(pluginId: string, version: string): KernelSecurityScanResult | undefined {
328328
return this.scanResults.get(`${pluginId}:${version}`);
329329
}
330330

packages/metadata/src/loaders/memory-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class MemoryLoader implements MetadataLoader {
6767
if (await this.exists(type, name)) {
6868
return {
6969
size: 0, // In-memory
70-
mtime: new Date(),
70+
mtime: new Date().toISOString(),
7171
format: 'json',
7272
};
7373
}

packages/metadata/src/loaders/remote-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class RemoteLoader implements MetadataLoader {
103103

104104
return {
105105
size: Number(response.headers.get('content-length') || 0),
106-
mtime: new Date(response.headers.get('last-modified') || Date.now()),
106+
mtime: new Date(response.headers.get('last-modified') || Date.now()).toISOString(),
107107
format: 'json',
108108
};
109109
}

packages/metadata/src/metadata-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class MetadataManager {
9191
try {
9292
const result = await loader.load(type, name, options);
9393
if (result.data) {
94-
return result.data;
94+
return result.data as T;
9595
}
9696
} catch (e) {
9797
this.logger.warn(`Loader ${loader.contract.name} failed to load ${type}:${name}`, { error: e });

packages/objectql/src/engine.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,13 @@ export class ObjectQL implements IDataEngine {
437437
await this.triggerHooks('beforeFind', hookContext);
438438

439439
try {
440-
const result = await driver.find(object, hookContext.input.ast, hookContext.input.options);
440+
const result = await driver.find(object, hookContext.input.ast as QueryAST, hookContext.input.options as any);
441441

442442
hookContext.event = 'afterFind';
443443
hookContext.result = result;
444444
await this.triggerHooks('afterFind', hookContext);
445445

446-
return hookContext.result;
446+
return hookContext.result as any[];
447447
} catch (e) {
448448
this.logger.error('Find operation failed', e as Error, { object });
449449
throw e;
@@ -480,13 +480,13 @@ export class ObjectQL implements IDataEngine {
480480
if (Array.isArray(hookContext.input.data)) {
481481
// Bulk Create
482482
if (driver.bulkCreate) {
483-
result = await driver.bulkCreate(object, hookContext.input.data, hookContext.input.options);
483+
result = await driver.bulkCreate(object, hookContext.input.data as any[], hookContext.input.options as any);
484484
} else {
485485
// Fallback loop
486-
result = await Promise.all(hookContext.input.data.map((item: any) => driver.create(object, item, hookContext.input.options)));
486+
result = await Promise.all((hookContext.input.data as any[]).map((item: any) => driver.create(object, item, hookContext.input.options as any)));
487487
}
488488
} else {
489-
result = await driver.create(object, hookContext.input.data, hookContext.input.options);
489+
result = await driver.create(object, hookContext.input.data, hookContext.input.options as any);
490490
}
491491

492492
hookContext.event = 'afterInsert';
@@ -529,11 +529,11 @@ export class ObjectQL implements IDataEngine {
529529
let result;
530530
if (hookContext.input.id) {
531531
// Single update by ID
532-
result = await driver.update(object, hookContext.input.id, hookContext.input.data, hookContext.input.options);
532+
result = await driver.update(object, hookContext.input.id as string, hookContext.input.data, hookContext.input.options as any);
533533
} else if (options?.multi && driver.updateMany) {
534534
// Bulk update by Query
535535
const ast = this.toQueryAST(object, { filter: options.filter });
536-
result = await driver.updateMany(object, ast, hookContext.input.data, hookContext.input.options);
536+
result = await driver.updateMany(object, ast, hookContext.input.data, hookContext.input.options as any);
537537
} else {
538538
throw new Error('Update requires an ID or options.multi=true');
539539
}
@@ -572,10 +572,10 @@ export class ObjectQL implements IDataEngine {
572572
try {
573573
let result;
574574
if (hookContext.input.id) {
575-
result = await driver.delete(object, hookContext.input.id, hookContext.input.options);
575+
result = await driver.delete(object, hookContext.input.id as string, hookContext.input.options as any);
576576
} else if (options?.multi && driver.deleteMany) {
577577
const ast = this.toQueryAST(object, { filter: options.filter });
578-
result = await driver.deleteMany(object, ast, hookContext.input.options);
578+
result = await driver.deleteMany(object, ast, hookContext.input.options as any);
579579
} else {
580580
throw new Error('Delete requires an ID or options.multi=true');
581581
}

0 commit comments

Comments
 (0)