import type { Connection } from 'mongoose'; import { factory } from '../factory'; /** * リトライ可能なタスク作成属性 */ type ICreatingTask = Pick, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'identifier' | 'description'> & { expires?: never; }; /** * タスクリポジトリ */ export declare class TaskRepo { private readonly taskModel; constructor(connection: Connection); saveMany(taskAttributes: ICreatingTask[]): Promise<{ id: string; }[]>; /** * タスク識別子から検索する */ findByIdentifier(params: { identifier: string; name: factory.taskName; project: { id: string; }; }): Promise<{ id: string; status: factory.taskStatus; } | undefined>; /** * イベント予約集計タスクの冗長な作成を避けるためのメソッド */ findReadyAggregateEventTask(params: { project: { id: string; }; reservationFor: { id: string; }; }): Promise<(import("mongoose").FlattenMaps<{ identifier?: string | undefined; name: factory.taskName; description?: string | undefined; project: { id: string; typeOf: factory.organizationType.Project; }; data: import("@chevre/factory/lib/chevre/task").IData; status: factory.taskStatus; runsAt: Date; dateAborted?: Date | undefined; executionResults: { executedAt: Date; endDate: Date; error: string | import("@chevre/factory/lib/chevre/task").IExecutionErrorAsObject; }[]; executor?: { name: string; } | undefined; lastTriedAt?: Date | undefined; remainingNumberOfTries: number; numberOfTried: number; expires?: never | undefined; }> & { _id: import("mongoose").Types.ObjectId; } & { __v: number; }) | null>; /** * タスク識別子から冪等作成する * reimplement createIfNotExistByIdentifier(2025-03-28~) * reimplement runTaskByIdentifier(2026-08-03~) */ runTaskByIdentifier(params: ICreatingTask & { alternateName?: never; identifier: string; expires?: never; }): Promise; /** * 実行中止済タスクを強制的にリトライ * 中止済タスクでなければ何もしない */ retryForciblyIfAborted(params: { id: string; remainingNumberOfTries: number; }): Promise; } export {};