@chevre/domain 25.2.0-alpha.8 → 26.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/lib/chevre/eventEmitter/task.d.ts +2 -1
  2. package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
  3. package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
  4. package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
  5. package/lib/chevre/repo/action/acceptPay.js +47 -19
  6. package/lib/chevre/repo/action/actionProcess.js +57 -57
  7. package/lib/chevre/repo/action.d.ts +16 -9
  8. package/lib/chevre/repo/action.js +99 -180
  9. package/lib/chevre/repo/adminTask.d.ts +37 -0
  10. package/lib/chevre/repo/adminTask.js +163 -0
  11. package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
  12. package/lib/chevre/repo/aggregateOffer.js +16 -125
  13. package/lib/chevre/repo/aggregateTask.d.ts +37 -0
  14. package/lib/chevre/repo/aggregateTask.js +136 -0
  15. package/lib/chevre/repo/asyncAction.d.ts +69 -0
  16. package/lib/chevre/repo/asyncAction.js +237 -0
  17. package/lib/chevre/repo/concurrentLock.d.ts +3 -1
  18. package/lib/chevre/repo/creativeWork.d.ts +2 -3
  19. package/lib/chevre/repo/credentials.d.ts +2 -1
  20. package/lib/chevre/repo/customerType.d.ts +2 -3
  21. package/lib/chevre/repo/event.d.ts +10 -11
  22. package/lib/chevre/repo/eventOffer.d.ts +4 -5
  23. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
  24. package/lib/chevre/repo/eventSeries.d.ts +4 -5
  25. package/lib/chevre/repo/message.d.ts +1 -1
  26. package/lib/chevre/repo/message.js +1 -1
  27. package/lib/chevre/repo/mongoose/schemas/action.js +57 -57
  28. package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +13 -0
  29. package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
  30. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
  31. package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
  32. package/lib/chevre/repo/mongoose/schemas/scheduledTasks.d.ts +16 -0
  33. package/lib/chevre/repo/mongoose/schemas/scheduledTasks.js +103 -0
  34. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
  35. package/lib/chevre/repo/mongoose/schemas/task.d.ts +6 -1
  36. package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
  37. package/lib/chevre/repo/note.d.ts +3 -4
  38. package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
  39. package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +2 -2
  40. package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
  41. package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
  42. package/lib/chevre/repo/offerCatalog.d.ts +2 -3
  43. package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
  44. package/lib/chevre/repo/order.d.ts +2 -0
  45. package/lib/chevre/repo/order.js +14 -14
  46. package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
  47. package/lib/chevre/repo/orderInTransaction.js +181 -3
  48. package/lib/chevre/repo/passport.d.ts +2 -1
  49. package/lib/chevre/repo/person.d.ts +0 -15
  50. package/lib/chevre/repo/person.js +122 -108
  51. package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
  52. package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
  53. package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
  54. package/lib/chevre/repo/place/seat.d.ts +4 -5
  55. package/lib/chevre/repo/place/section.d.ts +3 -4
  56. package/lib/chevre/repo/priceSpecification.d.ts +4 -4
  57. package/lib/chevre/repo/product.d.ts +3 -4
  58. package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
  59. package/lib/chevre/repo/rateLimit/offer.js +0 -12
  60. package/lib/chevre/repo/reservation.d.ts +2 -3
  61. package/lib/chevre/repo/scheduledTask.d.ts +90 -0
  62. package/lib/chevre/repo/scheduledTask.js +223 -0
  63. package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
  64. package/lib/chevre/repo/stockHolder.d.ts +1 -1
  65. package/lib/chevre/repo/stockHolder.js +0 -146
  66. package/lib/chevre/repo/task.d.ts +30 -71
  67. package/lib/chevre/repo/task.js +59 -345
  68. package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
  69. package/lib/chevre/repo/transaction/placeOrder.js +43 -83
  70. package/lib/chevre/repo/transaction.d.ts +2 -2
  71. package/lib/chevre/repo/transactionNumberCounter.js +0 -34
  72. package/lib/chevre/repo/transactionProcess.d.ts +2 -1
  73. package/lib/chevre/repo/transactionProcess.js +0 -13
  74. package/lib/chevre/repository.d.ts +20 -0
  75. package/lib/chevre/repository.js +46 -2
  76. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
  77. package/lib/chevre/service/aggregation/system.d.ts +2 -2
  78. package/lib/chevre/service/aggregation/system.js +1 -1
  79. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -1
  80. package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +1 -1
  81. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  82. package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
  83. package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
  84. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  85. package/lib/chevre/service/assetTransaction/refund.js +1 -1
  86. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +1 -1
  87. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -67
  88. package/lib/chevre/service/asyncAction.d.ts +16 -0
  89. package/lib/chevre/service/asyncAction.js +36 -0
  90. package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
  91. package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
  92. package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
  93. package/lib/chevre/service/asyncActionHandler.js +89 -0
  94. package/lib/chevre/service/notification/factory.d.ts +2 -4
  95. package/lib/chevre/service/notification/factory.js +26 -24
  96. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +12 -6
  97. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +12 -4
  98. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
  99. package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
  100. package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
  101. package/lib/chevre/service/offer/event/authorize.js +2 -2
  102. package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
  103. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
  104. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
  105. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
  106. package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
  107. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
  108. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +15 -12
  109. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
  110. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
  111. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +4 -0
  112. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +20 -9
  113. package/lib/chevre/service/offer/onEventChanged.js +2 -2
  114. package/lib/chevre/service/order/confirmPayTransaction.js +1 -1
  115. package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
  116. package/lib/chevre/service/order/deleteOrder.js +8 -1
  117. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
  118. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
  119. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
  120. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
  121. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
  122. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
  123. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  124. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
  125. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
  126. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  127. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
  128. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +3 -3
  129. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +0 -3
  130. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +73 -44
  131. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
  132. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +53 -33
  133. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
  134. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
  135. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +6 -4
  136. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  137. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +3 -7
  138. package/lib/chevre/service/order/onOrderUpdated.js +1 -1
  139. package/lib/chevre/service/order/payOrder.d.ts +2 -0
  140. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
  141. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
  142. package/lib/chevre/service/order/placeOrder/factory.js +3 -21
  143. package/lib/chevre/service/order/placeOrder.d.ts +4 -5
  144. package/lib/chevre/service/order/placeOrder.js +20 -31
  145. package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
  146. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
  147. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
  148. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
  149. package/lib/chevre/service/payment/any/authorize.js +13 -37
  150. package/lib/chevre/service/payment/any/factory.d.ts +7 -7
  151. package/lib/chevre/service/payment/any/factory.js +19 -22
  152. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +7 -1
  153. package/lib/chevre/service/payment/any/findAcceptAction.js +34 -15
  154. package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +4 -0
  155. package/lib/chevre/service/payment/any/findAuthorizeAction.js +20 -9
  156. package/lib/chevre/service/payment/any/findCheckAction.d.ts +4 -0
  157. package/lib/chevre/service/payment/any/findCheckAction.js +20 -9
  158. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
  159. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +5 -67
  160. package/lib/chevre/service/payment/any/onPayActionCompleted.js +1 -1
  161. package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.js +1 -1
  162. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
  163. package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
  164. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
  165. package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
  166. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  167. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
  168. package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
  169. package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
  170. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +1 -1
  171. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -1
  172. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -1
  173. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +20 -11
  174. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -1
  175. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +1 -1
  176. package/lib/chevre/service/reserve/searchByOrder.js +2 -6
  177. package/lib/chevre/service/reserve.d.ts +2 -2
  178. package/lib/chevre/service/reserve.js +3 -3
  179. package/lib/chevre/service/scheduledTask.d.ts +11 -0
  180. package/lib/chevre/service/scheduledTask.js +40 -0
  181. package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.d.ts +14 -0
  182. package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +56 -0
  183. package/lib/chevre/service/scheduledTaskHandler.d.ts +12 -0
  184. package/lib/chevre/service/scheduledTaskHandler.js +66 -0
  185. package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
  186. package/lib/chevre/service/task/aggregateOffers.js +2 -1
  187. package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
  188. package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
  189. package/lib/chevre/service/task/authorizePayment.js +3 -1
  190. package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
  191. package/lib/chevre/service/task/cancelReservation.js +2 -1
  192. package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
  193. package/lib/chevre/service/task/confirmReserveTransaction.js +3 -8
  194. package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
  195. package/lib/chevre/service/task/deleteTransaction.js +2 -1
  196. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
  197. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
  198. package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
  199. package/lib/chevre/service/task/onEventChanged.js +2 -1
  200. package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
  201. package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
  202. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +2 -2
  203. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +1 -1
  204. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
  205. package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
  206. package/lib/chevre/service/task/onResourceUpdated.js +10 -9
  207. package/lib/chevre/service/task/placeOrder.d.ts +2 -2
  208. package/lib/chevre/service/task/placeOrder.js +6 -3
  209. package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
  210. package/lib/chevre/service/task/refund.d.ts +2 -2
  211. package/lib/chevre/service/task/refund.js +4 -10
  212. package/lib/chevre/service/task/reserve.d.ts +2 -2
  213. package/lib/chevre/service/task/reserve.js +2 -1
  214. package/lib/chevre/service/task/returnOrder.d.ts +2 -2
  215. package/lib/chevre/service/task/returnOrder.js +2 -1
  216. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  217. package/lib/chevre/service/task/sendOrder.d.ts +2 -2
  218. package/lib/chevre/service/task/sendOrder.js +2 -1
  219. package/lib/chevre/service/task/voidPayTransaction.js +3 -7
  220. package/lib/chevre/service/task/voidPayment.d.ts +2 -2
  221. package/lib/chevre/service/task/voidPayment.js +2 -1
  222. package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
  223. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +1 -1
  224. package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -1
  225. package/lib/chevre/service/taskHandler.d.ts +2 -2
  226. package/lib/chevre/service/taskHandler.js +36 -37
  227. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
  228. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
  229. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
  230. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
  231. package/lib/chevre/service/transaction/deleteTransaction.d.ts +1 -1
  232. package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
  233. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
  234. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
  235. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
  236. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
  237. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +32 -4
  238. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +10 -1
  239. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
  240. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +6 -2
  241. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +23 -9
  242. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
  243. package/lib/chevre/service/transaction/placeOrder/confirm.js +30 -40
  244. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
  245. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
  246. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
  247. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
  248. package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
  249. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
  250. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
  251. package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
  252. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
  253. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  254. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  255. package/lib/chevre/service.d.ts +8 -0
  256. package/lib/chevre/service.js +23 -1
  257. package/lib/chevre/taskSettings.d.ts +3 -4
  258. package/package.json +8 -11
  259. package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
  260. package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
  261. package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
  262. package/lib/chevre/service/reserve/findReservations.js +0 -61
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ScheduledTaskRepo = void 0;
7
+ const moment_1 = __importDefault(require("moment"));
8
+ const factory_1 = require("../factory");
9
+ const settings_1 = require("../settings");
10
+ const scheduledTasks_1 = require("./mongoose/schemas/scheduledTasks");
11
+ const executableTaskProjection = {
12
+ _id: 0,
13
+ id: { $toString: '$_id' },
14
+ // 必要最低限にprojection(2024-04-23~)
15
+ data: 1,
16
+ name: 1,
17
+ status: 1,
18
+ numberOfTried: 1,
19
+ project: 1,
20
+ remainingNumberOfTries: 1,
21
+ runsAt: 1,
22
+ expires: 1
23
+ };
24
+ /**
25
+ * 予定タスクリポジトリ
26
+ */
27
+ class ScheduledTaskRepo {
28
+ scheduledTaskModel;
29
+ constructor(connection) {
30
+ this.scheduledTaskModel = connection.model(scheduledTasks_1.modelName, (0, scheduledTasks_1.createSchema)());
31
+ }
32
+ async addScheduledTasks(taskAttributes) {
33
+ if (taskAttributes.length > 0) {
34
+ const creatingTasks = taskAttributes;
35
+ const result = await this.scheduledTaskModel.insertMany(creatingTasks, { ordered: false, rawResult: true });
36
+ if (result.insertedCount !== taskAttributes.length) {
37
+ throw new factory_1.factory.errors.Internal('all tasks not saved');
38
+ }
39
+ const savedTasks = Object.values(result.insertedIds)
40
+ .map((objectId) => {
41
+ return { id: objectId.toHexString() };
42
+ });
43
+ // イベントは発火しない
44
+ // if (emitImmediately) {
45
+ // savedTasks.forEach((savedTask) => {
46
+ // taskEventEmitter.emitTaskStatusChanged({
47
+ // id: savedTask.id,
48
+ // status: factory.taskStatus.Ready
49
+ // });
50
+ // });
51
+ // }
52
+ return savedTasks;
53
+ }
54
+ else {
55
+ return [];
56
+ }
57
+ }
58
+ async countPotentiallyRunningScheduledTasks(params) {
59
+ const { runsAt, limit, name } = params;
60
+ const nameEq = name.$eq;
61
+ if (!(runsAt.$lt instanceof Date)) {
62
+ throw new factory_1.factory.errors.Argument('runsAt.$lt', 'must be Date');
63
+ }
64
+ const query = this.scheduledTaskModel.countDocuments({
65
+ status: { $eq: factory_1.factory.taskStatus.Ready },
66
+ name: { $eq: nameEq },
67
+ runsAt: { $lt: params.runsAt.$lt }
68
+ });
69
+ if (typeof limit === 'number' && limit >= 0) {
70
+ query.limit(limit);
71
+ }
72
+ const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
73
+ .exec();
74
+ return { count };
75
+ }
76
+ /**
77
+ * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更
78
+ */
79
+ async runScheduledTaskIfExists(params) {
80
+ if (!(params.runsAt.$lt instanceof Date)) {
81
+ throw new factory_1.factory.errors.Argument('runsAt.$lt', 'must be Date');
82
+ }
83
+ // const { noEmitEvent } = options;
84
+ const projection = {
85
+ _id: 0,
86
+ id: { $toString: '$_id' },
87
+ name: 1
88
+ };
89
+ const nameEq = params.name.$eq;
90
+ const filter = {
91
+ status: { $eq: factory_1.factory.taskStatus.Ready },
92
+ name: { $eq: nameEq },
93
+ runsAt: { $lt: params.runsAt.$lt }
94
+ };
95
+ const doc = await this.scheduledTaskModel.findOneAndUpdate(filter, {
96
+ $set: {
97
+ status: factory_1.factory.taskStatus.Running, // 実行中に変更
98
+ lastTriedAt: new Date(),
99
+ executor: params.executor
100
+ },
101
+ $inc: {
102
+ remainingNumberOfTries: -1, // 残りトライ可能回数減らす
103
+ numberOfTried: 1 // トライ回数増やす
104
+ }
105
+ }, {
106
+ new: true,
107
+ projection,
108
+ sort: { runsAt: factory_1.factory.sortType.Ascending } // ソートは、実行日時で固定化(2026-07-31~)
109
+ // ...(typeof params.sort.numberOfTried === 'number' || typeof params.sort.runsAt === 'number')
110
+ // ? { sort: params.sort }
111
+ // : undefined
112
+ })
113
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
114
+ .lean()
115
+ .exec();
116
+ if (doc === null) {
117
+ return null;
118
+ }
119
+ // if (!noEmitEvent) {
120
+ // const changedTask: IRunningTaskByName = {
121
+ // id: doc.id,
122
+ // status: factory.taskStatus.Running,
123
+ // name: nameEq
124
+ // };
125
+ // taskEventEmitter.emitTaskStatusChanged(
126
+ // changedTask,
127
+ // // 現時点でタスク遅延実行ではnext指定なし(2026-07-30)
128
+ // // (typeof next === 'function') ? next : undefined
129
+ // );
130
+ // }
131
+ return doc;
132
+ }
133
+ /**
134
+ * Running -> findOneするだけ
135
+ */
136
+ async findRunningScheduledTaskById(params) {
137
+ const doc = await this.scheduledTaskModel.findOne({
138
+ _id: { $eq: params.id },
139
+ status: { $eq: factory_1.factory.taskStatus.Running },
140
+ }, executableTaskProjection)
141
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
142
+ .lean()
143
+ .exec();
144
+ if (doc === null) {
145
+ return null;
146
+ }
147
+ return doc;
148
+ }
149
+ /**
150
+ * タスクIDから実行結果とステータスを保管する
151
+ * Abortedの場合、dateAbortedもセットする
152
+ */
153
+ async setExecutionResultAndStatus(params, update) {
154
+ const { id } = params;
155
+ const { status, executionResult } = update;
156
+ await this.scheduledTaskModel.updateOne({ _id: { $eq: id } }, {
157
+ $set: {
158
+ status,
159
+ ...(status === factory_1.factory.taskStatus.Aborted) ? { dateAborted: executionResult.endDate } : undefined // 2025-08-04~
160
+ },
161
+ $push: { executionResults: executionResult }
162
+ })
163
+ .exec();
164
+ }
165
+ async deleteTooOldReadyTasks(params) {
166
+ return this.scheduledTaskModel.deleteMany({
167
+ 'project.id': { $eq: params.project.id },
168
+ name: { $eq: params.name },
169
+ status: { $eq: factory_1.factory.taskStatus.Ready },
170
+ runsAt: { $lt: params.runsAt.$lt }
171
+ })
172
+ .exec();
173
+ }
174
+ /**
175
+ * Runningのまま一定期間超過し、かつ、remainingNumberOfTries>0のタスクをReadyに変更する
176
+ */
177
+ async retryScheduledTasks(params) {
178
+ const lastTriedAtShoudBeLessThan = (0, moment_1.default)()
179
+ .add(-params.intervalInMinutes, 'minutes')
180
+ .toDate();
181
+ return this.scheduledTaskModel.updateMany(
182
+ // retryOrAbortScheduledTasksインデックスと連動
183
+ {
184
+ status: { $eq: factory_1.factory.taskStatus.Running },
185
+ remainingNumberOfTries: { $gte: 1 }, // まだリトライ可能なもの
186
+ lastTriedAt: {
187
+ $exists: true,
188
+ $lt: lastTriedAtShoudBeLessThan
189
+ },
190
+ }, {
191
+ $set: {
192
+ status: factory_1.factory.taskStatus.Ready // 実行前に変更
193
+ }
194
+ })
195
+ .exec();
196
+ }
197
+ /**
198
+ * $eq:0をAbortedにする(タスク名称に関わらず)
199
+ * これらは中止されてもhubへ通知しない
200
+ */
201
+ async abortScheduledTasks(params) {
202
+ const lastTriedAtShoudBeLessThan = (0, moment_1.default)()
203
+ .add(-params.intervalInMinutes, 'minutes')
204
+ .toDate();
205
+ return this.scheduledTaskModel.updateMany(
206
+ // retryOrAbortScheduledTasksインデックスと連動
207
+ {
208
+ status: { $eq: factory_1.factory.taskStatus.Running },
209
+ remainingNumberOfTries: { $eq: 0 },
210
+ lastTriedAt: {
211
+ $exists: true,
212
+ $lt: lastTriedAtShoudBeLessThan
213
+ },
214
+ }, {
215
+ $set: {
216
+ status: factory_1.factory.taskStatus.Aborted,
217
+ dateAborted: new Date()
218
+ }
219
+ })
220
+ .exec();
221
+ }
222
+ }
223
+ exports.ScheduledTaskRepo = ScheduledTaskRepo;
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { Connection } from 'mongoose';
1
+ import { Connection, mongo } from 'mongoose';
3
2
  import { factory } from '../factory';
4
3
  type IMakesOffer = Pick<factory.seller.IMakesOffer, 'typeOf' | 'availableAtOrFrom' | 'eligibleTransactionDuration'>;
5
4
  type IMakesOfferAsFindResult = IMakesOffer & {
@@ -51,7 +50,7 @@ export declare class SellerMakesOfferRepo {
51
50
  id: string;
52
51
  };
53
52
  }[];
54
- }): Promise<BulkWriteResult | undefined>;
53
+ }): Promise<mongo.BulkWriteResult | undefined>;
55
54
  /**
56
55
  * 販売者とアプリケーションに対してオファーが存在すれば削除する
57
56
  */
@@ -67,6 +66,6 @@ export declare class SellerMakesOfferRepo {
67
66
  id: string;
68
67
  };
69
68
  }[];
70
- }): Promise<BulkWriteResult | undefined>;
69
+ }): Promise<mongo.BulkWriteResult | undefined>;
71
70
  }
72
71
  export {};
@@ -16,7 +16,7 @@ export declare class StockHolderRepo implements AbstractStockHolderRepo {
16
16
  /**
17
17
  * 座席をロックする
18
18
  */
19
- lock(lockKey: ILockKey & {}): Promise<void>;
19
+ lock(lockKey: ILockKey): Promise<void>;
20
20
  /**
21
21
  * 座席ロックを解除する
22
22
  */
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StockHolderRepo = void 0;
4
- // import type { RedisClientType } from 'redis';
5
4
  const factory_1 = require("../factory");
6
5
  const pendingReservation_1 = require("./pendingReservation");
7
6
  const SEARCH_OFFERS_MAX_LENGTH = 100;
@@ -9,36 +8,11 @@ const SEARCH_OFFERS_MAX_LENGTH = 100;
9
8
  * 保留予約リポジトリ
10
9
  */
11
10
  class StockHolderRepo {
12
- // public static KEY_PREFIX_NEW: string = 'stockHolder';
13
- // private readonly redisClient: RedisClientType | undefined;
14
11
  pendingReservationRepo;
15
12
  constructor(params) {
16
13
  const { connection } = params;
17
- // this.redisClient = redisClient;
18
14
  this.pendingReservationRepo = new pendingReservation_1.PendingReservationRepo(connection);
19
15
  }
20
- // private static offer2field(params: IOffer, hasTicketedSeat: boolean) {
21
- // if (hasTicketedSeat) {
22
- // return `${params.seatSection}:${params.seatNumber}`;
23
- // } else {
24
- // // 予約IDをfieldにする場合
25
- // const serviceOutputId = params.itemOffered?.serviceOutput?.id;
26
- // if (typeof serviceOutputId === 'string') {
27
- // return serviceOutputId;
28
- // } else {
29
- // throw new factory.errors.Internal('offer2field requires itemOffered.serviceOutput.id');
30
- // }
31
- // }
32
- // }
33
- // private static createKey(params: {
34
- // eventId: string;
35
- // startDate: Date;
36
- // }): string {
37
- // if (!(params.startDate instanceof Date)) {
38
- // throw new factory.errors.Argument('startDate', 'must be Date');
39
- // }
40
- // return `${StockHolderRepo.KEY_PREFIX_NEW}:${params.eventId}`;
41
- // }
42
16
  /**
43
17
  * 座席をロックする(maxキャパシティチェック有)
44
18
  */
@@ -54,16 +28,6 @@ class StockHolderRepo {
54
28
  }
55
29
  else {
56
30
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
57
- // if (this.redisClient === undefined) {
58
- // throw new factory.errors.Internal('redisClient required');
59
- // }
60
- // const key = StockHolderRepo.createKey({ eventId: lockKey.eventId, startDate: lockKey.startDate });
61
- // await this.redisClient.watch(key);
62
- // const hashCount = await this.redisClient.hLen(key);
63
- // if (hashCount + lockKey.offers.length > maximum) {
64
- // throw new factory.errors.Argument('Event', 'maximumAttendeeCapacity exceeded');
65
- // }
66
- // await this.lock(lockKey);
67
31
  }
68
32
  }
69
33
  /**
@@ -79,59 +43,11 @@ class StockHolderRepo {
79
43
  startDate: lockKey.startDate,
80
44
  hasTicketedSeat: lockKey.hasTicketedSeat
81
45
  });
82
- // const key = StockHolderRepo.createKey({ eventId: lockKey.eventId, startDate: lockKey.startDate });
83
- // await this.checkIfConflicted({ key, eventId: lockKey.eventId, useMongoose });
84
46
  if (useMongoose) {
85
47
  return this.pendingReservationRepo.lock(lockKey);
86
48
  }
87
49
  else {
88
50
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
89
- // if (this.redisClient === undefined) {
90
- // throw new factory.errors.Internal('redisClient required');
91
- // }
92
- // const value = lockKey.holder;
93
- // const multi = this.redisClient.multi();
94
- // const fields = lockKey.offers.map((offer) => StockHolderRepo.offer2field(offer, lockKey.hasTicketedSeat));
95
- // // check uniqueness(2025-04-20~)
96
- // const uniqueFields = [...new Set(fields)];
97
- // if (uniqueFields.length !== fields.length) {
98
- // throw new factory.errors.Argument('offers', 'offers must be unique');
99
- // }
100
- // fields.forEach((field) => {
101
- // multi.hSetNX(key, field, value);
102
- // });
103
- // const results = await multi.expireAt(
104
- // key,
105
- // moment(lockKey.expires)
106
- // .unix()
107
- // )
108
- // .exec();
109
- // const lockedFields: string[] = [];
110
- // if (Array.isArray(results)) {
111
- // results.slice(0, fields.length)
112
- // .forEach((r, index) => {
113
- // if (r === 1 || (<any>r) === true) {
114
- // lockedFields.push(fields[index]);
115
- // }
116
- // });
117
- // }
118
- // const lockedAll = lockedFields.length === fields.length;
119
- // // expireAtReplyの検証も追加する(2023-04-19~)
120
- // const expiredAll = results.slice(fields.length)
121
- // .every((r) => (r === 1 || (<any>r) === true));
122
- // if (!lockedAll || !expiredAll) {
123
- // if (lockedFields.length > 0) {
124
- // // 全て仮押さえできなければ仮押さえできたものは解除
125
- // await this.redisClient.multi()
126
- // .hDel(key, lockedFields)
127
- // .exec();
128
- // }
129
- // if (!lockedAll) {
130
- // throw new factory.errors.AlreadyInUse(factory.reservationType.EventReservation, ['ticketedSeat'], 'Already hold');
131
- // } else {
132
- // throw new factory.errors.Internal('timeout cannot be set unexpectedly');
133
- // }
134
- // }
135
51
  }
136
52
  }
137
53
  /**
@@ -144,20 +60,11 @@ class StockHolderRepo {
144
60
  startDate: params.startDate,
145
61
  hasTicketedSeat: params.hasTicketedSeat
146
62
  });
147
- // const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
148
- // await this.checkIfConflicted({ key, eventId: params.eventId, useMongoose });
149
63
  if (useMongoose) {
150
64
  return this.pendingReservationRepo.unlock(params);
151
65
  }
152
66
  else {
153
67
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
154
- // if (this.redisClient === undefined) {
155
- // throw new factory.errors.Internal('redisClient required');
156
- // }
157
- // const field = StockHolderRepo.offer2field(params.offer, params.hasTicketedSeat);
158
- // await this.redisClient.multi()
159
- // .hDel(key, field)
160
- // .exec();
161
68
  }
162
69
  }
163
70
  /**
@@ -174,16 +81,6 @@ class StockHolderRepo {
174
81
  }
175
82
  else {
176
83
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
177
- // if (this.redisClient === undefined) {
178
- // throw new factory.errors.Internal('redisClient required');
179
- // }
180
- // const key = StockHolderRepo.createKey({ eventId: params.event.id, startDate: params.event.startDate });
181
- // const reply = await this.redisClient.hLen(key);
182
- // let fieldCount: number = 0;
183
- // if (typeof reply === 'number') {
184
- // fieldCount = Number(reply);
185
- // }
186
- // return fieldCount;
187
84
  }
188
85
  }
189
86
  /**
@@ -200,12 +97,6 @@ class StockHolderRepo {
200
97
  }
201
98
  else {
202
99
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
203
- // if (this.redisClient === undefined) {
204
- // throw new factory.errors.Internal('redisClient required');
205
- // }
206
- // const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
207
- // const field = StockHolderRepo.offer2field(params.offer, params.hasTicketedSeat);
208
- // return this.redisClient.hGet(key, field);
209
100
  }
210
101
  }
211
102
  async searchHolders(params) {
@@ -223,32 +114,8 @@ class StockHolderRepo {
223
114
  }
224
115
  else {
225
116
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
226
- // if (this.redisClient === undefined) {
227
- // throw new factory.errors.Internal('redisClient required');
228
- // }
229
- // const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
230
- // const fields = params.offers.map((o) => {
231
- // return StockHolderRepo.offer2field(o, params.hasTicketedSeat);
232
- // });
233
- // // Array reply: list of values associated with the given fields, in the same order as they are requested.
234
- // const result = await this.redisClient.hmGet(key, fields);
235
- // if (!Array.isArray(result)) {
236
- // throw new factory.errors.Internal(`searchAvailability got non-array: ${typeof result}`);
237
- // }
238
- // // そのまま返却(2023-04-17~)
239
- // return result;
240
117
  }
241
118
  }
242
- // public async checkIfConflicted(params: {
243
- // eventId: string;
244
- // startDate: Date;
245
- // }): Promise<void> {
246
- // const redisKeyExists = await this.redisKeyExists(params);
247
- // const mongoDocExists = await this.pendingReservationRepo.docExists(params);
248
- // if (redisKeyExists && mongoDocExists) {
249
- // throw new factory.errors.Internal(`repository conflicted. eventId:${params.eventId}`);
250
- // }
251
- // }
252
119
  /**
253
120
  * 新リポジトリを使用するかどうか
254
121
  */
@@ -258,19 +125,6 @@ class StockHolderRepo {
258
125
  }
259
126
  // always use mongo(2025-08-17~)
260
127
  return true;
261
- // let useMongoose = false;
262
- // const redisKeyExists = await this.redisKeyExists(params);
263
- // if (redisKeyExists) {
264
- // useMongoose = false;
265
- // } else {
266
- // // redis keyが存在しなければmongo利用
267
- // useMongoose = true;
268
- // }
269
- // // check confliction for test
270
- // if (USE_STOCK_HOLDER_CHECK_CONFLICT) {
271
- // await this.checkIfConflicted(params);
272
- // }
273
- // return useMongoose;
274
128
  }
275
129
  }
276
130
  exports.StockHolderRepo = StockHolderRepo;
@@ -1,45 +1,29 @@
1
- import type { AnyKeys, Connection, FilterQuery, ProjectionType, UpdateWriteOpResult } from 'mongoose';
1
+ import type { Connection, UpdateWriteOpResult } from 'mongoose';
2
2
  import { INextFunction } from '../eventEmitter/task';
3
3
  import { factory } from '../factory';
4
4
  import { IModel, IDocType } from './mongoose/schemas/task';
5
5
  import type { IExecutableTask } from '../taskSettings';
6
- interface IAggregationByStatus {
7
- taskCount: number;
8
- avgLatency: number;
9
- maxLatency: number;
10
- minLatency: number;
11
- percentilesLatency: {
12
- name: string;
13
- value: number;
14
- }[];
15
- }
16
- interface IStatus {
17
- status: factory.taskStatus;
18
- aggregation: IAggregationByStatus;
19
- }
20
- export interface IAggregateTask {
21
- statuses: IStatus[];
22
- }
23
- interface IOptionOnCreate {
24
- emitImmediately: boolean;
25
- }
26
- type IKeyOfProjection = keyof factory.task.ITask<factory.taskName>;
27
- type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'identifier' | 'description'>;
6
+ type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
7
+ /**
8
+ * リトライ可能なタスク作成属性
9
+ */
10
+ type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'identifier' | 'description'> & {
11
+ expires?: Date;
12
+ };
28
13
  /**
29
14
  * タスクリポジトリ
30
15
  */
31
16
  export declare class TaskRepo {
32
17
  readonly taskModel: IModel;
33
18
  constructor(connection: Connection);
34
- static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/deleteTransaction").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").ITask>[];
35
- runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'expires' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
19
+ runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
36
20
  alternateName?: never;
37
21
  identifier?: never;
38
22
  expires: Date;
39
23
  }, next: INextFunction): Promise<{
40
24
  id: string;
41
25
  }>;
42
- saveMany(taskAttributes: ICreatingTask[], options: IOptionOnCreate): Promise<{
26
+ saveMany(taskAttributes: ICreatingTask[]): Promise<{
43
27
  id: string;
44
28
  }[]>;
45
29
  /**
@@ -61,12 +45,10 @@ export declare class TaskRepo {
61
45
  */
62
46
  createIfNotExistByAlternateName(params: ICreatingTask & {
63
47
  alternateName: string;
64
- }, options: IOptionOnCreate): Promise<void>;
65
- /**
66
- * 取引削除タスク冪等作成
67
- */
68
- createDeleteTransactionTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.DeleteTransaction>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>, options: IOptionOnCreate): Promise<void>;
69
- createOnAssetTransactionStatusChangedTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>, options: IOptionOnCreate): Promise<void>;
48
+ identifier: string;
49
+ expires?: never;
50
+ }): Promise<void>;
51
+ createOnAssetTransactionStatusChangedTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>): Promise<void>;
70
52
  /**
71
53
  * Ready -> remainingNumberOfTriesが1減る
72
54
  * Running -> findOneするだけ
@@ -137,7 +119,7 @@ export declare class TaskRepo {
137
119
  name: string;
138
120
  };
139
121
  nameFilterBeforeRunsAt: boolean;
140
- }, next?: INextFunction): Promise<Pick<factory.task.ITask<factory.taskName>, 'id' | 'name'> | null>;
122
+ }): Promise<Pick<factory.task.ITask<factory.taskName>, 'id' | 'name'> | null>;
141
123
  /**
142
124
  * Readyのままで期限切れのタスクをExpiredに変更する
143
125
  */
@@ -190,28 +172,28 @@ export declare class TaskRepo {
190
172
  status: factory.taskStatus.Executed | factory.taskStatus.Running | factory.taskStatus.Aborted;
191
173
  executionResult: factory.task.IExecutionResult;
192
174
  }, next?: INextFunction): Promise<void>;
193
- count(params: factory.task.ISearchConditions): Promise<{
194
- count: number;
195
- }>;
196
175
  /**
197
- * 検索する
176
+ * タスクの状態を参照する
177
+ * 非同期アクション移行が完了したら廃止する(2026-07-29~)
198
178
  */
199
- projectFields(params: factory.task.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.task.ITask<factory.taskName>[]>;
179
+ findTaskById(params: {
180
+ id: {
181
+ $eq: string;
182
+ };
183
+ project: {
184
+ id: {
185
+ $eq: string;
186
+ };
187
+ };
188
+ name: factory.taskName;
189
+ }, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
190
+ id: string;
191
+ } | undefined)>;
200
192
  deleteByProject(params: {
201
193
  project: {
202
194
  id: string;
203
195
  };
204
196
  }): Promise<void>;
205
- deleteByName(params: {
206
- name: factory.taskName;
207
- status?: {
208
- $eq?: factory.taskStatus;
209
- };
210
- runsAt?: {
211
- $gte: Date;
212
- $lte: Date;
213
- };
214
- }): Promise<import("mongodb").DeleteResult>;
215
197
  /**
216
198
  * 不要なタスクを削除する
217
199
  */
@@ -229,28 +211,5 @@ export declare class TaskRepo {
229
211
  }): Promise<{
230
212
  count: number;
231
213
  }>;
232
- getCursor(conditions: FilterQuery<factory.task.ITask<factory.taskName>>, projection: ProjectionType<factory.task.ITask<factory.taskName>>): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
233
- _id: import("mongoose").Types.ObjectId;
234
- } & {
235
- __v: number;
236
- }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
237
- _id: import("mongoose").Types.ObjectId;
238
- } & {
239
- __v: number;
240
- }) | null>;
241
- unsetUnnecessaryFields(params: {
242
- filter: FilterQuery<factory.task.ITask<factory.taskName>>;
243
- $unset: AnyKeys<factory.task.ITask<factory.taskName>>;
244
- }): Promise<UpdateWriteOpResult>;
245
- aggregateTask(params: {
246
- project?: {
247
- id?: {
248
- $ne?: string;
249
- };
250
- };
251
- runsFrom: Date;
252
- runsThrough: Date;
253
- }): Promise<IAggregateTask>;
254
- private agggregateByStatus;
255
214
  }
256
215
  export {};