import type { Connection } from 'mongoose'; import { factory } from '../factory'; import { IDocType } from './mongoose/schemas/asyncAction'; import type { IExecutableTask } from '../taskSettings'; type ISavingTask = Pick, 'data' | 'executionResults' | 'name' | 'project' | 'runsAt' | 'status'> & { expires: Date; }; export type IExecutableAsyncAction = Pick, 'data' | 'expires' | 'id' | 'name' | 'project' | 'runsAt' | 'status'>; type IKeyOfProjection = keyof factory.task.ITask | 'expires'; /** * 非同期アクションリポジトリ */ export declare class AsyncActionRepo { private readonly asyncActionModel; constructor(connection: Connection); /** * Readyタスクをひとつ追加する */ addReadyAsyncAction(params: Pick & { alternateName?: never; identifier?: never; }): Promise<{ id: string; }>; /** * Ready -> Running */ executeAsyncActionById(params: { id: string; executor: { name: string; }; }): Promise; /** * 非同期アクションの状態を参照する */ findAsyncActionById(params: { id: { $eq: string; }; project: { id: { $eq: string; }; }; name: factory.taskName; }, inclusion: IKeyOfProjection[]): Promise<(IDocType & { id: string; } | undefined)>; /** * タスクIDから実行結果とステータスを保管する * Abortedの場合、dateAbortedもセットする */ setExecutionResultAndStatus(params: { /** * タスクID */ id: string; }, update: { status: factory.taskStatus.Executed | factory.taskStatus.Aborted; executionResult: factory.task.IExecutionResult; }): Promise; } export {};