import { Connection } from 'mongoose'; import { factory } from '../../../factory'; import { IModel as IActionModel, IDocType } from '../../mongoose/schemas/action'; import { IFindAnyActionsParams } from '../../factory/action/createMongoConditions'; import { ActionRecipeRepo, IActionRecipe, IRecipeAsActionAttributes } from './actionRecipe'; export type IAction4transaction = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.paymentMethod.any.IAction) : never; type IAuthorizeAction = factory.action.authorize.invoice.IAction | factory.action.authorize.offer.eventService.IAction | factory.action.authorize.paymentMethod.any.IAction | factory.action.authorize.ticketedObject.IAction; export type IAction = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction : T extends factory.actionType.AuthorizeAction ? IAuthorizeAction : T extends factory.actionType.CheckAction ? factory.action.check.paymentMethod.movieTicket.IAction : T extends factory.actionType.CreateAction ? factory.action.create.IAction : factory.action.IAction>; export interface ICancelActionAction { typeOf: factory.actionType.CancelAction; agent: factory.action.IParticipantAsPerson | factory.action.IParticipantAsProject | factory.action.IParticipantAsWebApplication; endTime: Date; startTime: Date; sameAs?: { id: string; typeOf: 'Task'; }; } export { IActionRecipe }; export type IKeyOfProjection = keyof IDocType | 'id'; export declare const AVAILABLE_PROJECT_FIELDS: IKeyOfProjection[]; interface IOptions { expireAfterSeconds: number; recipeExpireAfterSeconds: number; } export declare const DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; export declare const RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; /** * アクション状態管理リポジトリ */ export declare class ActionProcessRepo, TActionRecipe extends IActionRecipe> extends ActionRecipeRepo { protected readonly actionModel: IActionModel; private options; protected constructor(params: { connection: Connection; }, options: IOptions); /** * アクション開始 */ start(attributes: factory.action.IAttributes, // eslint-disable-line @typescript-eslint/no-explicit-any options?: { recipe?: IRecipeAsActionAttributes; }): Promise, 'id' | 'typeOf' | 'startDate'>>; completeWithVoid(params: { typeOf: TAction['typeOf']; id: string; result: any; recipe?: IRecipeAsActionAttributes; }): Promise; /** * アクション取消 */ cancelWithVoid(params: { typeOf: TAction['typeOf']; id: string; cancelAction?: Pick; }): Promise; /** * アクション失敗 */ giveUp(params: { typeOf: TAction['typeOf']; id: string; error: Error | Error[] | unknown; recipe?: IRecipeAsActionAttributes; }): Promise; findAnyActionById(params: { typeOf: TAction['typeOf']; id: string; }, inclusion?: IKeyOfProjection[], exclusion?: IKeyOfProjection[]): Promise; private findActionStatusById; /** * 汎用アクション検索 * 継承クラスから呼ぶ想定 */ protected findAnyActionsLegacy(params: Pick & { object?: { id?: never; movieTickets?: never; object?: never; orderNumber?: never; reservationFor?: never; reservationNumber?: never; event?: never; paymentMethod?: { accountId?: never; /** * 決済アクションの決済方法ID */ paymentMethodId?: { $eq?: string; $in?: string[]; }; typeOf?: never; }; /** * 承認アクションの決済方法ID */ paymentMethodId?: { $eq?: string; }; typeOf?: { $eq?: string; $in?: string[]; }; /** * 確定アクション、採用アクションなどの資産取引番号 */ transactionNumber?: { $eq?: string; }; }; sort?: never; actionStatusTypes?: never; agent?: never; about?: never; instrument?: never; location?: never; startFrom?: never; startThrough?: never; result?: never; }, inclusion: IKeyOfProjection[]): Promise; /** * 取引に対する汎用アクション検索 * 継承クラスから呼ぶ想定 * 件数はlimitされない */ protected findAnyActionsByPurpose(params: { typeOf?: T; purpose: { typeOf: factory.transactionType; id: string; }; object?: { typeOf?: { $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer; $in?: (factory.action.authorize.offer.eventService.ObjectType.SeatReservation)[]; }; paymentMethodId?: { $eq?: string; }; }; actionStatus?: { $eq?: factory.actionStatusType.CompletedActionStatus; }; sort?: factory.action.ISortOrder; }): Promise; }