Skip to content

Commit edddf61

Browse files
Copilothotlong
andcommitted
fix objectql build: cast hookContext.input.data to Record<string, unknown>
IDataDriver.create/update/updateMany require Record<string, unknown> but HookContext.input is Record<string, unknown> making .data typed as unknown. Added explicit casts at the 3 call sites in engine.ts (lines 901, 952, 955). Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/f6a26f6f-89b7-44f6-a67a-52714bd9c1a6
1 parent c9c1c51 commit edddf61

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/objectql/src/engine.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ export class ObjectQL implements IDataEngine {
898898
result = await Promise.all((hookContext.input.data as any[]).map((item: any) => driver.create(object, item, hookContext.input.options as any)));
899899
}
900900
} else {
901-
result = await driver.create(object, hookContext.input.data, hookContext.input.options as any);
901+
result = await driver.create(object, hookContext.input.data as Record<string, unknown>, hookContext.input.options as any);
902902
}
903903

904904
hookContext.event = 'afterInsert';
@@ -949,10 +949,10 @@ export class ObjectQL implements IDataEngine {
949949
try {
950950
let result;
951951
if (hookContext.input.id) {
952-
result = await driver.update(object, hookContext.input.id as string, hookContext.input.data, hookContext.input.options as any);
952+
result = await driver.update(object, hookContext.input.id as string, hookContext.input.data as Record<string, unknown>, hookContext.input.options as any);
953953
} else if (options?.multi && driver.updateMany) {
954954
const ast = this.toQueryAST(object, { filter: options.filter });
955-
result = await driver.updateMany(object, ast, hookContext.input.data, hookContext.input.options as any);
955+
result = await driver.updateMany(object, ast, hookContext.input.data as Record<string, unknown>, hookContext.input.options as any);
956956
} else {
957957
throw new Error('Update requires an ID or options.multi=true');
958958
}

0 commit comments

Comments
 (0)