Skip to content

Commit 4b34cc3

Browse files
Copilothotlong
andcommitted
Fix all CI build errors: type casting issues in metadata and objectql packages
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 45fc055 commit 4b34cc3

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

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)