chore: add type option for emitLogEvent
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -252,12 +252,15 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
});
|
||||
}
|
||||
|
||||
async emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void> {
|
||||
const serliazedBody = JSON.stringify(body);
|
||||
async emitLogEvent({
|
||||
taskId,
|
||||
body,
|
||||
}: TaskStoreEmitOptions<{ message: string } & JsonObject>): Promise<void> {
|
||||
const serializedBo = JSON.stringify(body);
|
||||
await this.db<RawDbTaskEventRow>('task_events').insert({
|
||||
task_id: taskId,
|
||||
event_type: 'log',
|
||||
body: serliazedBody,
|
||||
body: serializedBo,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -180,9 +180,9 @@ export interface TaskBroker {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type TaskStoreEmitOptions = {
|
||||
export type TaskStoreEmitOptions<TBody = JsonObject> = {
|
||||
taskId: string;
|
||||
body: JsonObject;
|
||||
body: TBody;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user