@chevre/domain 25.2.0-alpha.9 → 26.0.0-alpha.1

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.d.ts +16 -9
  7. package/lib/chevre/repo/action.js +99 -180
  8. package/lib/chevre/repo/adminScheduledTask.d.ts +20 -0
  9. package/lib/chevre/repo/adminScheduledTask.js +95 -0
  10. package/lib/chevre/repo/adminTask.d.ts +37 -0
  11. package/lib/chevre/repo/adminTask.js +163 -0
  12. package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
  13. package/lib/chevre/repo/aggregateOffer.js +16 -125
  14. package/lib/chevre/repo/aggregateTask.d.ts +37 -0
  15. package/lib/chevre/repo/aggregateTask.js +136 -0
  16. package/lib/chevre/repo/asyncAction.d.ts +69 -0
  17. package/lib/chevre/repo/asyncAction.js +237 -0
  18. package/lib/chevre/repo/concurrentLock.d.ts +3 -1
  19. package/lib/chevre/repo/creativeWork.d.ts +2 -3
  20. package/lib/chevre/repo/credentials.d.ts +2 -1
  21. package/lib/chevre/repo/customerType.d.ts +2 -3
  22. package/lib/chevre/repo/event.d.ts +10 -11
  23. package/lib/chevre/repo/eventOffer.d.ts +4 -5
  24. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
  25. package/lib/chevre/repo/eventSeries.d.ts +4 -5
  26. package/lib/chevre/repo/message.d.ts +1 -1
  27. package/lib/chevre/repo/message.js +1 -1
  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 +25 -0
  75. package/lib/chevre/repository.js +57 -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 +7 -5
  150. package/lib/chevre/service/payment/any/factory.d.ts +7 -7
  151. package/lib/chevre/service/payment/any/factory.js +18 -21
  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
@@ -3,72 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cancelByAcceptAction = cancelByAcceptAction;
4
4
  const factory_1 = require("../../../factory");
5
5
  const cancelReservation_1 = require("../../reserveCOA/cancelReservation");
6
- // /**
7
- // * 興行オファー承認アクションからCOA予約を取り消す
8
- // */
9
- // function cancel(
10
- // params: {
11
- // action: factory.action.authorize.offer.eventService.IAction;
12
- // },
13
- // options: {
14
- // /**
15
- // * cancelPendingReservation async?(2025-03-03~)
16
- // */
17
- // asyncCancelPendingReservation: boolean;
18
- // }
19
- // ): ICancelOperation<void> {
20
- // return async (repos: {
21
- // action: ActionRepo;
22
- // reserveService: COA.service.Reserve;
23
- // task: TaskRepo;
24
- // }) => {
25
- // // object.pendingTransactionに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
26
- // let delTmpReserveParams: COA.factory.reserve.IDelTmpReserveArgs | undefined;
27
- // // objectに進行中取引情報があれば利用する(2023-09-11~)
28
- // const pendingTransaction = params.action.object.pendingTransaction;
29
- // if (typeof pendingTransaction?.typeOf === 'string') {
30
- // delTmpReserveParams = {
31
- // theaterCode: pendingTransaction.theaterCode,
32
- // dateJouei: pendingTransaction.dateJouei,
33
- // titleCode: pendingTransaction.titleCode,
34
- // titleBranchNum: pendingTransaction.titleBranchNum,
35
- // timeBegin: pendingTransaction.timeBegin,
36
- // tmpReserveNum: pendingTransaction.tmpReserveNum
37
- // };
38
- // }
39
- // if (delTmpReserveParams !== undefined) {
40
- // const { asyncCancelPendingReservation } = options;
41
- // const object: factory.action.cancel.coaReserve.IObject = {
42
- // ...delTmpReserveParams,
43
- // reservationStatus: factory.reservationStatusType.ReservationPending,
44
- // transactionNumber: delTmpReserveParams.tmpReserveNum,
45
- // typeOf: factory.assetTransactionType.COAReserveTransaction
46
- // };
47
- // const instrument: factory.action.cancel.coaReserve.IPlaceOrderAsInstrument[] = [params.action.purpose];
48
- // if (asyncCancelPendingReservation) {
49
- // // support async(2025-03-03~)
50
- // const data: factory.task.cancelPendingReservation.IPotentialCancelCOAReserveAction = { object, instrument };
51
- // const cancelPendingReservationTask: factory.task.cancelPendingReservation.IAttributes = {
52
- // project: { id: params.action.project.id, typeOf: factory.organizationType.Project },
53
- // name: factory.taskName.CancelPendingReservation,
54
- // status: factory.taskStatus.Ready,
55
- // runsAt: new Date(),
56
- // remainingNumberOfTries: 10,
57
- // numberOfTried: 0,
58
- // executionResults: [],
59
- // data
60
- // };
61
- // await repos.task.saveMany([cancelPendingReservationTask], { emitImmediately: true });
62
- // } else {
63
- // await cancelPendingReservation({
64
- // project: { id: params.action.project.id },
65
- // object,
66
- // instrument
67
- // })(repos);
68
- // }
69
- // }
70
- // };
71
- // }
72
6
  /**
73
7
  * 興行オファー採用アクションからCOA予約を取り消す
74
8
  */
@@ -115,7 +49,7 @@ function cancelByAcceptAction(params, options) {
115
49
  executionResults: [],
116
50
  data
117
51
  };
118
- await repos.task.saveMany([cancelPendingReservationTask], { emitImmediately: true });
52
+ await repos.task.saveMany([cancelPendingReservationTask]);
119
53
  }
120
54
  else {
121
55
  await (0, cancelReservation_1.cancelPendingReservation)({
@@ -0,0 +1,16 @@
1
+ import type { IExecuteSettings as IMinimumExecuteSettings, INextFunction } from '../eventEmitter/task';
2
+ type IExecuteSettings = IMinimumExecuteSettings;
3
+ type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
4
+ declare function executeAsyncActionById(params: {
5
+ /**
6
+ * タスクID
7
+ */
8
+ id: string;
9
+ executor: {
10
+ /**
11
+ * タスク実行者名称
12
+ */
13
+ name: string;
14
+ };
15
+ }, next?: INextFunction): IOperation<void>;
16
+ export { executeAsyncActionById };
@@ -0,0 +1,36 @@
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.executeAsyncActionById = executeAsyncActionById;
7
+ /**
8
+ * 非同期アクションサービス
9
+ */
10
+ const debug_1 = __importDefault(require("debug"));
11
+ const asyncActionHandler_1 = require("./asyncActionHandler");
12
+ const debug = (0, debug_1.default)('chevre-domain:service:task');
13
+ function executeAsyncActionById(params, next) {
14
+ return async (settings) => {
15
+ const asyncActionRepo = new (await import('../repo/asyncAction.js')).AsyncActionRepo(settings.connection);
16
+ const { id, executor } = params;
17
+ let task = null;
18
+ try {
19
+ task = await asyncActionRepo.executeAsyncActionById({
20
+ id,
21
+ executor: { name: executor.name }
22
+ });
23
+ }
24
+ catch (error) {
25
+ /* istanbul ignore next */
26
+ debug('service.asyncAction.executeAsyncActionById error:', error);
27
+ }
28
+ // タスクがなければ終了
29
+ if (task !== null) {
30
+ await (0, asyncActionHandler_1.executeAsyncAction)(task, (typeof next === 'function') ? next : undefined)(settings, {
31
+ executeById: true,
32
+ executeByName: false
33
+ });
34
+ }
35
+ };
36
+ }
@@ -0,0 +1,15 @@
1
+ import type { IExecutedTask } from '../../eventEmitter/task';
2
+ import type { AsyncActionRepo, IExecutableAsyncAction } from '../../repo/asyncAction';
3
+ /**
4
+ * タスク実行失敗時処理
5
+ */
6
+ declare function onOperationFailed(params: {
7
+ task: IExecutableAsyncAction;
8
+ now: Date;
9
+ error: any;
10
+ }): (repos: {
11
+ asyncAction: AsyncActionRepo;
12
+ }) => Promise<{
13
+ executedTask: IExecutedTask;
14
+ }>;
15
+ export { onOperationFailed };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.onOperationFailed = onOperationFailed;
4
+ const factory_1 = require("../../factory");
5
+ /**
6
+ * タスク実行失敗時処理
7
+ */
8
+ function onOperationFailed(params) {
9
+ return async (repos) => {
10
+ let error = params.error;
11
+ const { task, now } = params;
12
+ if (error === null || typeof error !== 'object') {
13
+ error = { message: String(error) };
14
+ }
15
+ const endDate = new Date();
16
+ // 非同期アクションはワンタイムタスクなのでリトライはありえない
17
+ // ワンタイムタスクは分析連携しない
18
+ const result = {
19
+ executedAt: now,
20
+ endDate,
21
+ error: {
22
+ ...error,
23
+ code: error.code,
24
+ message: error.message,
25
+ name: error.name,
26
+ stack: error.stack
27
+ }
28
+ };
29
+ await repos.asyncAction.setExecutionResultAndStatus({ id: task.id }, {
30
+ status: factory_1.factory.taskStatus.Aborted,
31
+ executionResult: result
32
+ });
33
+ const executedTask = {
34
+ id: task.id,
35
+ remainingNumberOfTries: 0,
36
+ name: task.name,
37
+ status: factory_1.factory.taskStatus.Aborted,
38
+ executionResult: result
39
+ };
40
+ return { executedTask };
41
+ };
42
+ }
@@ -0,0 +1,13 @@
1
+ import type { INextFunction } from '../eventEmitter/task';
2
+ import type { ICallResult, ICallableTaskOperation, IExecutableTaskKeys, IOperationExecute } from '../taskSettings';
3
+ import type { IExecutableAsyncAction } from '../repo/asyncAction';
4
+ export declare const taskLoader: {
5
+ load: (taskName: string) => Promise<{
6
+ call: ICallableTaskOperation;
7
+ }>;
8
+ };
9
+ /**
10
+ * 非同期アクションを実行する
11
+ */
12
+ declare function executeAsyncAction(task: IExecutableAsyncAction, next?: INextFunction): IOperationExecute<void>;
13
+ export { ICallableTaskOperation, ICallResult, IExecutableTaskKeys, IOperationExecute, executeAsyncAction };
@@ -0,0 +1,89 @@
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.taskLoader = void 0;
7
+ exports.executeAsyncAction = executeAsyncAction;
8
+ const debug_1 = __importDefault(require("debug"));
9
+ const moment_1 = __importDefault(require("moment"));
10
+ const factory_1 = require("../factory");
11
+ const onOperationFailed_1 = require("./asyncActionHandler/onOperationFailed");
12
+ const debug = (0, debug_1.default)('chevre-domain:service:asyncActionHandler');
13
+ exports.taskLoader = {
14
+ load: (taskName) => {
15
+ return import(`./task/${taskName}.js`);
16
+ }
17
+ };
18
+ /**
19
+ * 非同期アクションを実行する
20
+ */
21
+ function executeAsyncAction(task, next) {
22
+ const now = new Date();
23
+ debug('executing an executableTask...', task, now);
24
+ return async (settings, options) => {
25
+ const asyncActionRepo = new (await import('../repo/asyncAction.js')).AsyncActionRepo(settings.connection);
26
+ let executedTask;
27
+ try {
28
+ // 期限検証(2024-04-23~)
29
+ if (task.expires instanceof Date) {
30
+ const taskExpired = (0, moment_1.default)(now)
31
+ .isAfter(task.expires);
32
+ if (taskExpired) {
33
+ throw new factory_1.factory.errors.Internal(`task expired [expires:${task.expires}]`);
34
+ }
35
+ }
36
+ // remainingNumberOfTriesは存在しないので検証不要
37
+ // remainingNumberOfTries<0ならcallを実行しない(2025-08-04~)
38
+ // タスク名の関数が定義されていなければ、TypeErrorとなる
39
+ const { call } = await exports.taskLoader.load(task.name); // testが書きづらいのでtaskLoader経由で呼ぶ
40
+ const callResult = await call({
41
+ ...task,
42
+ numberOfTried: 1, // ひとまず固定でok(2026-07-26~)
43
+ remainingNumberOfTries: 0 // ひとまず固定でok(2026-07-26~)
44
+ })(settings, options);
45
+ const result = {
46
+ executedAt: now,
47
+ endDate: new Date(),
48
+ // enable overwriting task.executionResults.error on Executed(2024-05-29~)
49
+ error: (callResult?.error instanceof Error)
50
+ ? {
51
+ ...callResult.error,
52
+ message: callResult.error.message
53
+ }
54
+ : ''
55
+ };
56
+ await asyncActionRepo.setExecutionResultAndStatus({ id: task.id }, {
57
+ status: factory_1.factory.taskStatus.Executed,
58
+ executionResult: result
59
+ });
60
+ executedTask = {
61
+ id: task.id,
62
+ remainingNumberOfTries: 0, // one timeの前提なのでひとまず固定で0
63
+ name: task.name,
64
+ status: factory_1.factory.taskStatus.Executed,
65
+ executionResult: result
66
+ };
67
+ }
68
+ catch (error) {
69
+ const onOperationFailedResult = await (0, onOperationFailed_1.onOperationFailed)({
70
+ task, now, error,
71
+ })({ asyncAction: asyncActionRepo });
72
+ executedTask = onOperationFailedResult.executedTask;
73
+ }
74
+ finally {
75
+ if (typeof next === 'function') {
76
+ if (executedTask === undefined) {
77
+ executedTask = {
78
+ id: task.id,
79
+ remainingNumberOfTries: 0, // one timeの前提なのでひとまず固定で0
80
+ name: task.name,
81
+ status: factory_1.factory.taskStatus.Aborted,
82
+ executionResult: {} // eslint-disable-line @typescript-eslint/no-explicit-any
83
+ };
84
+ }
85
+ await next(executedTask)(settings);
86
+ }
87
+ }
88
+ };
89
+ }
@@ -5,11 +5,9 @@ export interface ILineNotifyMessage {
5
5
  subject: string;
6
6
  content: string;
7
7
  }
8
- export declare function task2lineNotify(params: {
9
- task: factory.task.ITask<factory.taskName>;
10
- }): ILineNotifyMessage;
11
8
  export declare function tasks2lineNotify(params: {
12
- tasks: factory.task.ITask<factory.taskName>[];
9
+ tasks: Pick<factory.task.ITask<factory.taskName>, 'id' | 'executionResults' | 'project' | 'name' | 'runsAt'>[];
10
+ limit: number;
13
11
  }): ILineNotifyMessage;
14
12
  export declare function createSendEmailMessageRecipe(params: {
15
13
  mailData?: MailData;
@@ -4,37 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ABORT_REPORT_SUBJECT = void 0;
7
- exports.task2lineNotify = task2lineNotify;
8
7
  exports.tasks2lineNotify = tasks2lineNotify;
9
8
  exports.createSendEmailMessageRecipe = createSendEmailMessageRecipe;
10
9
  const moment_1 = __importDefault(require("moment"));
11
10
  const factory_1 = require("../../factory");
12
11
  exports.ABORT_REPORT_SUBJECT = 'tasks aborted';
13
- function task2lineNotify(params) {
14
- const task = params.task;
15
- const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
16
- let lastError = lastExecutionResult?.error;
17
- if (typeof lastError === 'string') {
18
- lastError = { message: lastError, name: 'Error' };
19
- }
20
- const lastMessage = `${String(lastError?.name)} ${String(lastError?.message)}`;
21
- const content = `project:${task.project?.id}
22
- id:${task.id}
23
- name:${task.name}
24
- runsAt:${(0, moment_1.default)(task.runsAt)
25
- .toISOString()}
26
- lastTriedAt:${(0, moment_1.default)(task.lastTriedAt)
27
- .toISOString()}
28
- numberOfTried:${task.numberOfTried}
29
- lastMessage:${lastMessage}`;
30
- return {
31
- subject: exports.ABORT_REPORT_SUBJECT,
32
- content: content
33
- };
34
- }
12
+ // function task2lineNotify(params: {
13
+ // task: factory.task.ITask<factory.taskName>;
14
+ // }): ILineNotifyMessage {
15
+ // const task = params.task;
16
+ // const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
17
+ // let lastError = lastExecutionResult?.error;
18
+ // if (typeof lastError === 'string') {
19
+ // lastError = { message: lastError, name: 'Error' };
20
+ // }
21
+ // const lastMessage = `${String(lastError?.name)} ${String(lastError?.message)}`;
22
+ // const content = `project:${task.project?.id}
23
+ // id:${task.id}
24
+ // name:${task.name}
25
+ // runsAt:${moment(task.runsAt)
26
+ // .toISOString()}
27
+ // lastTriedAt:${moment((task.lastTriedAt as Date))
28
+ // .toISOString()}
29
+ // numberOfTried:${task.numberOfTried}
30
+ // lastMessage:${lastMessage}`;
31
+ // return {
32
+ // subject: ABORT_REPORT_SUBJECT,
33
+ // content: content
34
+ // };
35
+ // }
35
36
  const MAX_LAST_MESSAGE_LENGTH = 60;
36
37
  function tasks2lineNotify(params) {
37
- const subject = `${params.tasks.length} ${exports.ABORT_REPORT_SUBJECT}`;
38
+ const abortedTasksCount = (params.tasks.length >= params.limit) ? `over ${params.tasks.length}` : params.tasks.length;
39
+ const subject = `${abortedTasksCount} ${exports.ABORT_REPORT_SUBJECT}`;
38
40
  let content;
39
41
  // あまりに通知タスク数が多いケースに対応
40
42
  if (params.tasks.length > 10) {
@@ -1,13 +1,19 @@
1
- import type { TaskRepo } from '../../repo/task';
1
+ import type { AdminTaskRepo } from '../../repo/adminTask';
2
2
  import type { IntegrationSettingRepo } from '../../repo/setting/integration';
3
+ interface INotifyAbortedTasksRepos {
4
+ adminTask: AdminTaskRepo;
5
+ integrationSetting: IntegrationSettingRepo;
6
+ }
3
7
  /**
4
8
  * 中止されたタスクリストをEメールで通知する
5
9
  * add(2025-03-13~)
6
10
  */
7
11
  declare function notifyAbortedTasksByEmail(params: {
8
12
  dateAbortedGte: Date;
9
- }): (repos: {
10
- task: TaskRepo;
11
- integrationSetting: IntegrationSettingRepo;
12
- }) => Promise<void>;
13
- export { notifyAbortedTasksByEmail };
13
+ dateAbortedLte: Date;
14
+ /**
15
+ * 中止タスクがあまりに多いと性能に影響するので、現実的にタスク数を制限する
16
+ */
17
+ limit: number;
18
+ }): (repos: INotifyAbortedTasksRepos) => Promise<void>;
19
+ export { notifyAbortedTasksByEmail, INotifyAbortedTasksRepos };
@@ -16,17 +16,25 @@ const debug = (0, debug_1.default)('chevre-domain:service:notification');
16
16
  function notifyAbortedTasksByEmail(params) {
17
17
  return async (repos) => {
18
18
  const abortedTasksWithoutReport = await repos.integrationSetting.getByKey('abortedTasksWithoutReport');
19
- const abortedTasks = await repos.task.projectFields({
19
+ const abortedTasks = await repos.adminTask.findTasks({
20
+ limit: params.limit,
21
+ page: 1,
20
22
  status: { $eq: factory_1.factory.taskStatus.Aborted },
21
- dateAborted: { $gte: params.dateAbortedGte },
23
+ dateAborted: {
24
+ $gte: params.dateAbortedGte,
25
+ $lte: params.dateAbortedLte,
26
+ },
22
27
  // 中止を報告しないタスク以外にフィルター
23
28
  ...(abortedTasksWithoutReport.length > 0)
24
29
  ? { name: { $nin: abortedTasksWithoutReport } }
25
30
  : undefined
26
- }, []);
31
+ }, ['executionResults', 'name', 'project', 'runsAt']);
27
32
  if (abortedTasks.length > 0) {
28
33
  // 開発者へ報告
29
- const message = (0, factory_2.tasks2lineNotify)({ tasks: abortedTasks });
34
+ const message = (0, factory_2.tasks2lineNotify)({
35
+ tasks: abortedTasks,
36
+ limit: params.limit
37
+ });
30
38
  const notifyResult = await (0, notifyByEmail_1.notifyByEmail)({
31
39
  subject: message.subject, content: message.content,
32
40
  logLevel: 'error'
@@ -1,5 +1,4 @@
1
1
  import { factory } from '../../../../factory';
2
- import { IMinimizedIndividualEvent } from '../../../../factory/event';
3
2
  declare function createReserveTransactionStartParams(params: {
4
3
  project: {
5
4
  id: string;
@@ -13,7 +12,6 @@ declare function createReserveTransactionStartParams(params: {
13
12
  transactionNumber: string;
14
13
  }): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
15
14
  declare function createAuthorizeSeatReservationActionAttributes(params: {
16
- event: Pick<IMinimizedIndividualEvent, 'id'>;
17
15
  instrument: {
18
16
  /**
19
17
  * 予約取引番号
@@ -21,8 +19,6 @@ declare function createAuthorizeSeatReservationActionAttributes(params: {
21
19
  transactionNumber: string;
22
20
  };
23
21
  transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
24
- }, options: {
25
- useLegacyAuthorizeOfferObject: boolean;
26
22
  }): factory.action.authorize.offer.eventService.IAttributes;
27
23
  declare function acceptedOffers2amount(params: {
28
24
  acceptedOffers: Pick<IResultAcceptedOffer, 'priceSpecification' | 'id'>[];
@@ -31,7 +27,9 @@ declare function acceptedOffers2authorizeResult(params: {
31
27
  acceptedOffers4result: IResultAcceptedOffer[];
32
28
  noOfferSpecified: boolean;
33
29
  ticketOffers: factory.product.ITicketOffer[];
34
- }): factory.action.authorize.offer.eventService.IResult;
30
+ }): factory.action.authorize.offer.eventService.IResult & {
31
+ onlyPrice?: boolean;
32
+ };
35
33
  type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
36
34
  export type IResultAcceptedOffer = Omit<factory.order.IOptimizedAcceptedOffer, 'priceSpecification'> & {
37
35
  itemOffered: factory.order.IEventReservation;