@chevre/domain 26.0.0-alpha.8 → 26.0.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 (317) hide show
  1. package/lib/chevre/eventEmitter/task.d.ts +8 -23
  2. package/lib/chevre/eventEmitter/task.js +2 -2
  3. package/lib/chevre/repo/acceptedOffer.d.ts +0 -7
  4. package/lib/chevre/repo/acceptedOffer.js +27 -27
  5. package/lib/chevre/repo/action/acceptCOAOffer.d.ts +3 -1
  6. package/lib/chevre/repo/action/acceptCOAOffer.js +8 -2
  7. package/lib/chevre/repo/action/acceptPay.d.ts +3 -1
  8. package/lib/chevre/repo/action/acceptPay.js +8 -4
  9. package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +120 -0
  10. package/lib/chevre/repo/action/{actionProcess.js → anyAction/actionProcess.js} +28 -157
  11. package/lib/chevre/repo/action/anyAction/actionRecipe.d.ts +37 -0
  12. package/lib/chevre/repo/action/anyAction/actionRecipe.js +53 -0
  13. package/lib/chevre/repo/action/authorizeInvoice.d.ts +5 -8
  14. package/lib/chevre/repo/action/authorizeInvoice.js +7 -4
  15. package/lib/chevre/repo/action/authorizeOffer.d.ts +3 -1
  16. package/lib/chevre/repo/action/authorizeOffer.js +7 -2
  17. package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +3 -1
  18. package/lib/chevre/repo/action/authorizePaymentMethod.js +7 -4
  19. package/lib/chevre/repo/action/authorizeTicketedObject.d.ts +3 -1
  20. package/lib/chevre/repo/action/authorizeTicketedObject.js +7 -2
  21. package/lib/chevre/repo/action/cancel.d.ts +25 -0
  22. package/lib/chevre/repo/action/cancel.js +47 -0
  23. package/lib/chevre/repo/action/checkMovieTicket.d.ts +3 -1
  24. package/lib/chevre/repo/action/checkMovieTicket.js +8 -1
  25. package/lib/chevre/repo/action/confirm.d.ts +11 -0
  26. package/lib/chevre/repo/action/confirm.js +16 -0
  27. package/lib/chevre/repo/action/create.d.ts +10 -0
  28. package/lib/chevre/repo/action/create.js +17 -0
  29. package/lib/chevre/repo/action/inform.d.ts +38 -0
  30. package/lib/chevre/repo/action/inform.js +146 -0
  31. package/lib/chevre/repo/action/order.d.ts +21 -0
  32. package/lib/chevre/repo/action/order.js +35 -0
  33. package/lib/chevre/repo/action/pay.d.ts +3 -1
  34. package/lib/chevre/repo/action/pay.js +7 -4
  35. package/lib/chevre/repo/action/refund.d.ts +3 -1
  36. package/lib/chevre/repo/action/refund.js +7 -4
  37. package/lib/chevre/repo/action/reserve.d.ts +21 -0
  38. package/lib/chevre/repo/action/reserve.js +37 -0
  39. package/lib/chevre/repo/action/returnAction.d.ts +11 -0
  40. package/lib/chevre/repo/action/returnAction.js +16 -0
  41. package/lib/chevre/repo/action/sendEmailMessage.d.ts +10 -0
  42. package/lib/chevre/repo/action/sendEmailMessage.js +17 -0
  43. package/lib/chevre/repo/action/sendOrder.d.ts +10 -0
  44. package/lib/chevre/repo/action/sendOrder.js +16 -0
  45. package/lib/chevre/repo/action/unknown2actionError.d.ts +6 -0
  46. package/lib/chevre/repo/action/unknown2actionError.js +15 -0
  47. package/lib/chevre/repo/action/update.d.ts +48 -0
  48. package/lib/chevre/repo/action/update.js +166 -0
  49. package/lib/chevre/repo/action/use.d.ts +39 -0
  50. package/lib/chevre/repo/action/use.js +153 -0
  51. package/lib/chevre/repo/{action.d.ts → adminAction.d.ts} +11 -37
  52. package/lib/chevre/repo/adminAction.js +176 -0
  53. package/lib/chevre/repo/adminAssetTransaction.d.ts +126 -0
  54. package/lib/chevre/repo/adminAssetTransaction.js +491 -0
  55. package/lib/chevre/repo/adminAsyncAction.d.ts +2 -2
  56. package/lib/chevre/repo/adminScheduledTask.d.ts +1 -1
  57. package/lib/chevre/repo/adminTask.d.ts +25 -8
  58. package/lib/chevre/repo/adminTask.js +31 -32
  59. package/lib/chevre/repo/adminTransaction.d.ts +131 -0
  60. package/lib/chevre/repo/adminTransaction.js +237 -0
  61. package/lib/chevre/repo/aggregateAction.d.ts +8 -11
  62. package/lib/chevre/repo/aggregateAction.js +0 -61
  63. package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
  64. package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
  65. package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
  66. package/lib/chevre/repo/aggregateTransaction.js +166 -0
  67. package/lib/chevre/repo/aggregateUseAction.d.ts +35 -0
  68. package/lib/chevre/repo/aggregateUseAction.js +164 -0
  69. package/lib/chevre/repo/aggregation.d.ts +0 -8
  70. package/lib/chevre/repo/aggregation.js +0 -10
  71. package/lib/chevre/repo/assetTransaction.d.ts +10 -235
  72. package/lib/chevre/repo/assetTransaction.js +48 -636
  73. package/lib/chevre/repo/asyncAction.d.ts +2 -2
  74. package/lib/chevre/repo/authorization.d.ts +0 -6
  75. package/lib/chevre/repo/authorization.js +15 -27
  76. package/lib/chevre/repo/message.d.ts +0 -7
  77. package/lib/chevre/repo/message.js +0 -38
  78. package/lib/chevre/repo/migrateAction.d.ts +48 -0
  79. package/lib/chevre/repo/migrateAction.js +32 -0
  80. package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +11 -0
  81. package/lib/chevre/repo/mongoose/schemas/action/inform.js +82 -0
  82. package/lib/chevre/repo/mongoose/schemas/action/update.d.ts +12 -0
  83. package/lib/chevre/repo/mongoose/schemas/action/update.js +112 -0
  84. package/lib/chevre/repo/mongoose/schemas/{ownershipInfo.d.ts → action/use.d.ts} +4 -6
  85. package/lib/chevre/repo/mongoose/schemas/action/use.js +92 -0
  86. package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -3
  87. package/lib/chevre/repo/mongoose/schemas/action.js +22 -7
  88. package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +1 -0
  89. package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +19 -1
  90. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
  91. package/lib/chevre/repo/mongoose/schemas/aggregation.js +8 -1
  92. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +95 -76
  93. package/lib/chevre/repo/mongoose/schemas/authorization.js +25 -18
  94. package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
  95. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
  96. package/lib/chevre/repo/mongoose/schemas/message.js +8 -1
  97. package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
  98. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +5 -16
  99. package/lib/chevre/repo/mongoose/schemas/task.d.ts +2 -5
  100. package/lib/chevre/repo/mongoose/schemas/task.js +134 -118
  101. package/lib/chevre/repo/mongoose/schemas/ticket.js +8 -1
  102. package/lib/chevre/repo/orderInTransaction.d.ts +0 -3
  103. package/lib/chevre/repo/orderInTransaction.js +30 -22
  104. package/lib/chevre/repo/scheduledTask.d.ts +4 -1
  105. package/lib/chevre/repo/scheduledTask.js +3 -25
  106. package/lib/chevre/repo/task.d.ts +44 -150
  107. package/lib/chevre/repo/task.js +13 -446
  108. package/lib/chevre/repo/taskDelayed.d.ts +74 -0
  109. package/lib/chevre/repo/taskDelayed.js +195 -0
  110. package/lib/chevre/repo/taskRunning.d.ts +35 -0
  111. package/lib/chevre/repo/taskRunning.js +89 -0
  112. package/lib/chevre/repo/ticket.d.ts +0 -6
  113. package/lib/chevre/repo/ticket.js +0 -11
  114. package/lib/chevre/repo/transaction.d.ts +1 -187
  115. package/lib/chevre/repo/transaction.js +2 -383
  116. package/lib/chevre/repository.d.ts +65 -25
  117. package/lib/chevre/repository.js +144 -56
  118. package/lib/chevre/service/aggregation/system.d.ts +9 -8
  119. package/lib/chevre/service/aggregation/system.js +5 -5
  120. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
  121. package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +0 -10
  122. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +0 -1
  123. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +0 -1
  124. package/lib/chevre/service/assetTransaction/pay/start.d.ts +0 -1
  125. package/lib/chevre/service/assetTransaction/refund.d.ts +0 -1
  126. package/lib/chevre/service/assetTransaction/refund.js +2 -2
  127. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +4 -2
  128. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +4 -2
  129. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +8 -4
  130. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -1
  131. package/lib/chevre/service/asyncAction.d.ts +2 -2
  132. package/lib/chevre/service/asyncAction.js +1 -4
  133. package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +2 -2
  134. package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +0 -2
  135. package/lib/chevre/service/asyncActionHandler.d.ts +4 -4
  136. package/lib/chevre/service/asyncActionHandler.js +11 -13
  137. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +4 -2
  138. package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
  139. package/lib/chevre/service/event.d.ts +4 -2
  140. package/lib/chevre/service/event.js +3 -3
  141. package/lib/chevre/service/notification/sendEmailMessage.d.ts +4 -2
  142. package/lib/chevre/service/notification/sendEmailMessage.js +3 -3
  143. package/lib/chevre/service/notification/triggerWebhook.d.ts +4 -2
  144. package/lib/chevre/service/notification/triggerWebhook.js +5 -16
  145. package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
  146. package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +0 -1
  147. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +4 -2
  148. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
  149. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +9 -5
  150. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
  151. package/lib/chevre/service/offer/event/voidTransaction.d.ts +6 -4
  152. package/lib/chevre/service/offer/event/voidTransaction.js +7 -9
  153. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +6 -4
  154. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -15
  155. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
  156. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
  157. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +0 -4
  158. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +19 -19
  159. package/lib/chevre/service/offer/onEventChanged.js +0 -2
  160. package/lib/chevre/service/order/confirmPayTransaction.d.ts +4 -10
  161. package/lib/chevre/service/order/confirmPayTransaction.js +7 -11
  162. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
  163. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +2 -56
  164. package/lib/chevre/service/order/deleteOrder.d.ts +2 -2
  165. package/lib/chevre/service/order/deleteOrder.js +1 -2
  166. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
  167. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
  168. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +2 -4
  169. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +2 -4
  170. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +2 -2
  171. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
  172. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +1 -9
  173. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
  174. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +4 -8
  175. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
  176. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -11
  177. package/lib/chevre/service/order/onOrderUpdated/factory.js +0 -3
  178. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +4 -2
  179. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
  180. package/lib/chevre/service/order/placeOrder.d.ts +6 -4
  181. package/lib/chevre/service/order/placeOrder.js +9 -17
  182. package/lib/chevre/service/order/returnOrder.d.ts +4 -4
  183. package/lib/chevre/service/order/returnOrder.js +11 -43
  184. package/lib/chevre/service/order/sendOrder.d.ts +4 -6
  185. package/lib/chevre/service/order/sendOrder.js +30 -72
  186. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +0 -1
  187. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +0 -1
  188. package/lib/chevre/service/payment/any/authorize.d.ts +0 -1
  189. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +0 -4
  190. package/lib/chevre/service/payment/any/findAcceptAction.js +19 -19
  191. package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +0 -4
  192. package/lib/chevre/service/payment/any/findAuthorizeAction.js +19 -19
  193. package/lib/chevre/service/payment/any/findCheckAction.d.ts +0 -4
  194. package/lib/chevre/service/payment/any/findCheckAction.js +19 -19
  195. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +0 -1
  196. package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +0 -1
  197. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
  198. package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +0 -1
  199. package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +0 -1
  200. package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
  201. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -2
  202. package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -2
  203. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +0 -1
  204. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +0 -1
  205. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +0 -1
  206. package/lib/chevre/service/payment/creditCard/authorize.d.ts +0 -1
  207. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +0 -1
  208. package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +0 -1
  209. package/lib/chevre/service/payment/faceToFace.d.ts +0 -2
  210. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
  211. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +0 -1
  212. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +0 -1
  213. package/lib/chevre/service/project.d.ts +0 -6
  214. package/lib/chevre/service/project.js +0 -2
  215. package/lib/chevre/service/reserve/cancelReservation.d.ts +7 -3
  216. package/lib/chevre/service/reserve/cancelReservation.js +15 -25
  217. package/lib/chevre/service/reserve/checkInReservation.d.ts +4 -2
  218. package/lib/chevre/service/reserve/checkInReservation.js +2 -2
  219. package/lib/chevre/service/reserve/confirmReservation.d.ts +4 -2
  220. package/lib/chevre/service/reserve/confirmReservation.js +10 -36
  221. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -1
  222. package/lib/chevre/service/reserve/useReservation.d.ts +6 -2
  223. package/lib/chevre/service/reserve/useReservation.js +6 -24
  224. package/lib/chevre/service/reserveCOA/cancelReservation.d.ts +4 -2
  225. package/lib/chevre/service/reserveCOA/cancelReservation.js +3 -3
  226. package/lib/chevre/service/scheduledTask.d.ts +1 -4
  227. package/lib/chevre/service/scheduledTask.js +3 -10
  228. package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +1 -2
  229. package/lib/chevre/service/scheduledTaskHandler.js +0 -13
  230. package/lib/chevre/service/task/acceptCOAOffer.js +1 -14
  231. package/lib/chevre/service/task/authorizePayment.js +1 -7
  232. package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
  233. package/lib/chevre/service/task/cancelReservation.js +3 -5
  234. package/lib/chevre/service/task/checkMovieTicket.js +1 -7
  235. package/lib/chevre/service/task/checkResource.js +14 -57
  236. package/lib/chevre/service/task/confirmPayTransaction.js +11 -12
  237. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -2
  238. package/lib/chevre/service/task/confirmReserveTransaction.js +12 -7
  239. package/lib/chevre/service/task/createAccountingReport.js +8 -15
  240. package/lib/chevre/service/task/deleteTransaction.js +10 -41
  241. package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
  242. package/lib/chevre/service/task/invalidatePaymentUrl.js +0 -1
  243. package/lib/chevre/service/task/onAuthorizationCreated.js +4 -13
  244. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +4 -2
  245. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +4 -4
  246. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +4 -2
  247. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +4 -4
  248. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +4 -2
  249. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +4 -4
  250. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +4 -2
  251. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +4 -4
  252. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +4 -2
  253. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +4 -4
  254. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +4 -2
  255. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +4 -4
  256. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +4 -2
  257. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +4 -4
  258. package/lib/chevre/service/task/onResourceDeleted.js +4 -3
  259. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +0 -1
  260. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
  261. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +0 -1
  262. package/lib/chevre/service/task/onResourceUpdated.js +0 -10
  263. package/lib/chevre/service/task/pay.js +0 -1
  264. package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +0 -1
  265. package/lib/chevre/service/task/payment/payByTask.d.ts +0 -1
  266. package/lib/chevre/service/task/payment/refundByTask.d.ts +0 -1
  267. package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +0 -2
  268. package/lib/chevre/service/task/placeOrder.js +8 -6
  269. package/lib/chevre/service/task/publishPaymentUrl.js +2 -13
  270. package/lib/chevre/service/task/refund.js +0 -1
  271. package/lib/chevre/service/task/reserve.js +3 -6
  272. package/lib/chevre/service/task/returnOrder.js +3 -7
  273. package/lib/chevre/service/task/returnPayTransaction.js +9 -19
  274. package/lib/chevre/service/task/returnReserveTransaction.js +5 -6
  275. package/lib/chevre/service/task/sendEmailMessage.js +2 -2
  276. package/lib/chevre/service/task/sendOrder.js +4 -8
  277. package/lib/chevre/service/task/syncResourcesFromCOA.js +31 -23
  278. package/lib/chevre/service/task/triggerWebhook.js +4 -2
  279. package/lib/chevre/service/task/useReservation.js +6 -2
  280. package/lib/chevre/service/task/voidPayment.js +0 -2
  281. package/lib/chevre/service/task/voidReserveTransaction.js +11 -13
  282. package/lib/chevre/service/task.d.ts +3 -22
  283. package/lib/chevre/service/task.js +8 -40
  284. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +0 -1
  285. package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +3 -2
  286. package/lib/chevre/service/taskHandler/onOperationFailed.js +5 -16
  287. package/lib/chevre/service/taskHandler.d.ts +1 -2
  288. package/lib/chevre/service/taskHandler.js +7 -19
  289. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
  290. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
  291. package/lib/chevre/service/transaction/deleteTransaction.d.ts +8 -4
  292. package/lib/chevre/service/transaction/deleteTransaction.js +7 -7
  293. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
  294. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
  295. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +11 -17
  296. package/lib/chevre/service/transaction/returnOrder.js +11 -17
  297. package/lib/chevre/service/validation/validateOrder.d.ts +0 -4
  298. package/lib/chevre/service/validation/validateOrder.js +3 -3
  299. package/lib/chevre/taskSettings.d.ts +4 -4
  300. package/package.json +2 -2
  301. package/lib/chevre/repo/action/actionProcess.d.ts +0 -147
  302. package/lib/chevre/repo/action/checkThing.d.ts +0 -8
  303. package/lib/chevre/repo/action/checkThing.js +0 -13
  304. package/lib/chevre/repo/action.js +0 -468
  305. package/lib/chevre/repo/asyncActionLegacy.d.ts +0 -23
  306. package/lib/chevre/repo/asyncActionLegacy.js +0 -59
  307. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -227
  308. package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.d.ts +0 -25
  309. package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.js +0 -100
  310. package/lib/chevre/repo/ownershipInfo.d.ts +0 -122
  311. package/lib/chevre/repo/ownershipInfo.js +0 -466
  312. package/lib/chevre/repo/scheduledTaskLegacy.d.ts +0 -19
  313. package/lib/chevre/repo/scheduledTaskLegacy.js +0 -42
  314. package/lib/chevre/repo/scheduledTaskMigration.d.ts +0 -21
  315. package/lib/chevre/repo/scheduledTaskMigration.js +0 -70
  316. package/lib/chevre/service/validation/validateEvent.d.ts +0 -11
  317. package/lib/chevre/service/validation/validateEvent.js +0 -21
@@ -1,147 +0,0 @@
1
- import { Connection } from 'mongoose';
2
- import { factory } from '../../factory';
3
- import { IModel as IActionModel } from '../mongoose/schemas/action';
4
- import { IModel as IActionRecipeModel } from '../mongoose/schemas/actionRecipe';
5
- export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = 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;
6
- export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
7
- error?: any;
8
- purpose?: never;
9
- } : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
10
- export interface ICancelActionAction {
11
- typeOf: factory.actionType.CancelAction;
12
- agent: factory.action.IParticipantAsPerson | factory.action.IParticipantAsProject | factory.action.IParticipantAsWebApplication;
13
- endTime: Date;
14
- startTime: Date;
15
- sameAs?: {
16
- id: string;
17
- typeOf: 'Task';
18
- };
19
- }
20
- export type IActionRecipe<T extends factory.recipe.RecipeCategory> = T extends factory.recipe.RecipeCategory.checkMovieTicket ? factory.action.check.paymentMethod.movieTicket.IRecipe : T extends factory.recipe.RecipeCategory.payCreditCard ? factory.action.trade.pay.IPayCreditCardRecipe : T extends factory.recipe.RecipeCategory.payMovieTicket ? factory.action.trade.pay.IPayMovieTicketRecipe : T extends factory.recipe.RecipeCategory.publishPaymentUrl ? factory.action.accept.pay.IRecipe : T extends factory.recipe.RecipeCategory.refundCreditCard ? factory.action.trade.refund.IRefundCreditCardRecipe : T extends factory.recipe.RecipeCategory.refundMovieTicket ? factory.action.trade.refund.IRefundMovieTicketRecipe : T extends factory.recipe.RecipeCategory.authorizeInvoice ? factory.action.authorize.invoice.IAuthorizeInvoiceRecipe : T extends factory.recipe.RecipeCategory.authorizeInvoice3ds ? factory.action.authorize.invoice.IAuthorizeInvoice3dsRecipe : T extends factory.recipe.RecipeCategory.acceptCOAOffer ? factory.action.accept.coaOffer.IRecipe : T extends factory.recipe.RecipeCategory.confirmCOAReserve ? factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe : T extends factory.recipe.RecipeCategory.cancelPendingCOAReserve ? factory.action.cancel.coaReserve.ICancelPendingCOAReserveRecipe : T extends factory.recipe.RecipeCategory.returnCOAReserve ? factory.action.transfer.returnAction.reserveTransaction.IReturnCOAReserveRecipe : T extends factory.recipe.RecipeCategory.sendEmailMessage ? factory.action.transfer.send.message.email.IRecipe : never;
21
- export type IRecipeAsDocument = factory.recipe.IRecipe & {
22
- recipeFor: {
23
- id: string;
24
- typeOf: factory.actionType;
25
- };
26
- dateCreated: Date;
27
- dateModified?: Date;
28
- };
29
- export type IRecipeAsActionAttributes<T extends factory.recipe.RecipeCategory> = Pick<IActionRecipe<T>, 'project' | 'recipeCategory' | 'step' | 'typeOf'>;
30
- export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
31
- knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
32
- };
33
- export type IKeyOfProjection = keyof IAction<factory.actionType> | keyof IAction<factory.actionType.AuthorizeAction> | keyof IAction<factory.actionType.ReplaceAction> | 'identifier';
34
- export declare const AVAILABLE_PROJECT_FIELDS: IKeyOfProjection[];
35
- /**
36
- * アクション状態管理リポジトリ
37
- */
38
- export declare class ActionProcessRepo<TAction extends IAction<factory.actionType>, TActionRecipe extends IActionRecipe<factory.recipe.RecipeCategory>> {
39
- protected readonly actionModel: IActionModel;
40
- protected readonly actionRecipeModel: IActionRecipeModel;
41
- constructor(connection: Connection);
42
- static CREATE_MONGO_CONDITIONS(params: factory.action.ISearchConditions): any[];
43
- /**
44
- * アクション開始
45
- */
46
- start<T extends TAction['typeOf']>(attributes: factory.action.IAttributes<T, any, any>, // eslint-disable-line @typescript-eslint/no-explicit-any
47
- options?: {
48
- recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
49
- }): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>>;
50
- completeWithVoid(params: {
51
- typeOf: TAction['typeOf'];
52
- id: string;
53
- result: any;
54
- recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
55
- }): Promise<void>;
56
- /**
57
- * アクション取消
58
- */
59
- cancelWithVoid(params: {
60
- typeOf: TAction['typeOf'];
61
- id: string;
62
- cancelAction?: Pick<ICancelActionAction, 'agent' | 'sameAs' | 'startTime'>;
63
- }): Promise<void>;
64
- /**
65
- * アクション失敗
66
- */
67
- giveUp(params: {
68
- typeOf: TAction['typeOf'];
69
- id: string;
70
- error: Error | Error[] | unknown;
71
- recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
72
- }): Promise<void>;
73
- /**
74
- * 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
75
- */
76
- giveUpStartDatePassedCertainPeriod(params: {
77
- id?: {
78
- $eq?: string;
79
- };
80
- error: any;
81
- startDate: {
82
- $lt: Date;
83
- };
84
- }): Promise<import("mongoose").UpdateWriteOpResult>;
85
- findRecipeByAction<T extends TActionRecipe['recipeCategory']>(params: {
86
- project: {
87
- id: string;
88
- };
89
- recipeFor: {
90
- id: string;
91
- };
92
- }): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null>;
93
- findById(params: {
94
- typeOf: TAction['typeOf'];
95
- id: string;
96
- }, inclusion?: IKeyOfProjection[], exclusion?: IKeyOfProjection[]): Promise<TAction>;
97
- searchBySameAs(params: {
98
- sameAs: {
99
- id: {
100
- $eq: string;
101
- };
102
- };
103
- purpose?: {
104
- id: {
105
- $eq: string;
106
- };
107
- };
108
- /**
109
- * 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
110
- */
111
- typeOf: {
112
- $eq: TAction['typeOf'];
113
- };
114
- }): Promise<Pick<TAction, 'id' | 'actionStatus' | 'error' | 'purpose'>[]>;
115
- private findActionStatusById;
116
- /**
117
- * 汎用アクション検索
118
- * 継承クラスから呼ぶ想定
119
- */
120
- protected findAnyActions(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<TAction[]>;
121
- /**
122
- * 取引に対する汎用アクション検索
123
- * 継承クラスから呼ぶ想定
124
- * 件数はlimitされない
125
- */
126
- protected findAnyActionsByPurpose<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction>(params: {
127
- typeOf?: T;
128
- purpose: {
129
- typeOf: factory.transactionType;
130
- id: string;
131
- };
132
- object?: {
133
- typeOf?: {
134
- $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
135
- $in?: (factory.action.authorize.offer.eventService.ObjectType.SeatReservation)[];
136
- };
137
- paymentMethodId?: {
138
- $eq?: string;
139
- };
140
- };
141
- actionStatus?: {
142
- $eq?: factory.actionStatusType.CompletedActionStatus;
143
- };
144
- sort?: factory.action.ISortOrder;
145
- }): Promise<TAction[]>;
146
- protected upsertRecipe(savingRecipe: Pick<IRecipeAsDocument, 'project' | 'recipeCategory' | 'recipeFor' | 'step' | 'typeOf'>): Promise<void>;
147
- }
@@ -1,8 +0,0 @@
1
- import { factory } from '../../factory';
2
- import { ActionProcessRepo } from './actionProcess';
3
- export type ICheckThingAction = factory.action.check.thing.IAction;
4
- /**
5
- * 汎用リソース検証アクションリポジトリ
6
- */
7
- export declare class CheckThingActionRepo extends ActionProcessRepo<ICheckThingAction, never> {
8
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CheckThingActionRepo = void 0;
4
- // import { MONGO_MAX_TIME_MS } from '../settings';
5
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
6
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
7
- const actionProcess_1 = require("./actionProcess");
8
- /**
9
- * 汎用リソース検証アクションリポジトリ
10
- */
11
- class CheckThingActionRepo extends actionProcess_1.ActionProcessRepo {
12
- }
13
- exports.CheckThingActionRepo = CheckThingActionRepo;
@@ -1,468 +0,0 @@
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.ActionRepo = void 0;
7
- const moment_1 = __importDefault(require("moment"));
8
- const factory_1 = require("../factory");
9
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
10
- const actionProcess_1 = require("./action/actionProcess");
11
- /**
12
- * アクションリポジトリ
13
- */
14
- class ActionRepo extends actionProcess_1.ActionProcessRepo {
15
- // private readonly actionModel: IActionModel;
16
- // private readonly actionRecipeModel: IActionRecipeModel;
17
- // constructor(connection: Connection) {
18
- // this.actionModel = connection.model(modelName, createSchema());
19
- // this.actionRecipeModel = connection.model(recipeModelName, createRecipeSchema());
20
- // }
21
- /**
22
- * 汎用アクション検索
23
- */
24
- async findActionsByType(params, inclusion) {
25
- return (this.findAnyActions(params, inclusion));
26
- }
27
- // /**
28
- // * アクション開始
29
- // */
30
- // public async start<T extends factory.actionType>(
31
- // attributes: factory.action.IAttributes<T, any, any>,
32
- // options?: {
33
- // recipe?: IRecipeAsActionAttributes;
34
- // }
35
- // ): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>> {
36
- // const startDate = new Date();
37
- // const creatingAction: Omit<factory.action.IAction<factory.action.IAttributes<T, any, any>>, 'id'> = {
38
- // ...attributes,
39
- // actionStatus: factory.actionStatusType.ActiveActionStatus,
40
- // startDate
41
- // };s
42
- // // reimplemnt with insertMany(2024-08-29~)
43
- // const result = await this.actionModel.insertMany(creatingAction, { rawResult: true });
44
- // const id = result.insertedIds?.[0]?.toHexString();
45
- // if (typeof id !== 'string') {
46
- // throw new factory.errors.Internal('action not saved');
47
- // }
48
- // // add recipe(2024-06-09~)
49
- // const savingRecipe = options?.recipe;
50
- // if (savingRecipe?.typeOf === 'Recipe') {
51
- // await this.upsertRecipe({ ...savingRecipe, recipeFor: { id, typeOf: creatingAction.typeOf } });
52
- // }
53
- // return { id, startDate, typeOf: creatingAction.typeOf };
54
- // }
55
- // public async completeWithVoid(params: {
56
- // typeOf: factory.actionType;
57
- // id: string;
58
- // result: any;
59
- // recipe?: IRecipeAsActionAttributes;
60
- // }): Promise<void> {
61
- // if (params.recipe?.typeOf === 'Recipe') {
62
- // await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
63
- // }
64
- // const doc = await this.actionModel.findOneAndUpdate(
65
- // {
66
- // _id: { $eq: params.id },
67
- // typeOf: { $eq: params.typeOf }
68
- // },
69
- // {
70
- // $set: {
71
- // actionStatus: factory.actionStatusType.CompletedActionStatus,
72
- // result: params.result,
73
- // endDate: new Date()
74
- // }
75
- // },
76
- // { new: false, projection: { _id: 1 } }
77
- // )
78
- // .lean<{ _id: ObjectId }>()
79
- // .exec();
80
- // if (doc === null) {
81
- // throw new factory.errors.NotFound(this.actionModel.modelName);
82
- // }
83
- // }
84
- // /**
85
- // * アクション取消
86
- // */
87
- // public async cancelWithVoid(params: {
88
- // typeOf: factory.actionType.AcceptAction | factory.actionType.AuthorizeAction; // 現時点でAcceptAction,AuthorizeActionのみ対応
89
- // id: string;
90
- // cancelAction?: Pick<ICancelActionAction, 'agent' | 'sameAs' | 'startTime'>;
91
- // }): Promise<void> {
92
- // const cancelDate = new Date();
93
- // const cancelAction: ICancelActionAction | undefined = (params.cancelAction !== undefined)
94
- // ? {
95
- // ...params.cancelAction,
96
- // endTime: cancelDate,
97
- // typeOf: factory.actionType.CancelAction
98
- // }
99
- // : undefined;
100
- // const doc = await this.actionModel.findOneAndUpdate(
101
- // {
102
- // _id: { $eq: params.id },
103
- // typeOf: { $eq: params.typeOf },
104
- // actionStatus: { $ne: factory.actionStatusType.CanceledActionStatus } // 冪等性確保(2024-05-26~)
105
- // },
106
- // {
107
- // $set: {
108
- // actionStatus: factory.actionStatusType.CanceledActionStatus,
109
- // ...(cancelAction !== undefined) ? { cancelAction } : undefined // cancelAction連携(2024-05-26~)
110
- // }
111
- // },
112
- // { new: false, projection: { _id: 1 } }
113
- // )
114
- // .lean<{ _id: ObjectId }>()
115
- // .exec();
116
- // if (doc === null) {
117
- // // 既にCanceledActionStatusであればok
118
- // const existingAction = <Pick<IAction<typeof params.typeOf>, 'actionStatus'>>
119
- // await this.findById({ id: params.id, typeOf: params.typeOf }, ['actionStatus'], []);
120
- // if (existingAction.actionStatus !== factory.actionStatusType.CanceledActionStatus) {
121
- // throw new factory.errors.NotFound(this.actionModel.modelName);
122
- // }
123
- // }
124
- // // endDateが存在しなければセット(2024-04-22~)
125
- // await this.actionModel.updateOne(
126
- // {
127
- // _id: { $eq: params.id },
128
- // endDate: { $exists: false }
129
- // },
130
- // { $set: { endDate: cancelDate } }
131
- // )
132
- // .exec();
133
- // }
134
- // /**
135
- // * アクション失敗
136
- // */
137
- // public async giveUp(params: {
138
- // typeOf: factory.actionType;
139
- // id: string;
140
- // error: Error | Error[];
141
- // recipe?: IRecipeAsActionAttributes;
142
- // }): Promise<void> {
143
- // const actionError: IActionError | IActionError[] = (Array.isArray(params.error))
144
- // ? params.error.map((e) => ({ ...e, message: e.message, name: e.name }))
145
- // : { ...params.error, message: params.error.message, name: params.error.name };
146
- // if (params.recipe?.typeOf === 'Recipe') {
147
- // await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
148
- // }
149
- // const doc = await this.actionModel.findOneAndUpdate(
150
- // {
151
- // typeOf: { $eq: params.typeOf },
152
- // _id: { $eq: params.id }
153
- // },
154
- // {
155
- // $set: {
156
- // actionStatus: factory.actionStatusType.FailedActionStatus,
157
- // error: actionError,
158
- // endDate: new Date()
159
- // }
160
- // },
161
- // { new: true, projection: { _id: 1 } }
162
- // )
163
- // .lean<{ _id: ObjectId }>()
164
- // .exec();
165
- // if (doc === null) {
166
- // throw new factory.errors.NotFound(this.actionModel.modelName);
167
- // }
168
- // }
169
- // /**
170
- // * アクション再開
171
- // */
172
- // public async reStart(params: {
173
- // typeOf: factory.actionType;
174
- // id: string;
175
- // recipe?: IRecipeAsActionAttributes;
176
- // }): Promise<void> {
177
- // const doc = await this.actionModel.findOneAndUpdate(
178
- // {
179
- // _id: { $eq: params.id },
180
- // typeOf: { $eq: params.typeOf },
181
- // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
182
- // },
183
- // {
184
- // $set: {
185
- // actionStatus: factory.actionStatusType.ActiveActionStatus,
186
- // startDate: new Date()
187
- // },
188
- // $unset: { endDate: 1 }
189
- // },
190
- // { new: false, projection: { _id: 1 } }
191
- // )
192
- // .lean<{ _id: ObjectId }>()
193
- // .exec();
194
- // if (doc === null) {
195
- // throw new factory.errors.NotFound(this.actionModel.modelName);
196
- // }
197
- // // add recipe(2024-06-09~)
198
- // if (params.recipe?.typeOf === 'Recipe') {
199
- // await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
200
- // }
201
- // }
202
- // /**
203
- // * 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
204
- // */
205
- // public async giveUpStartDatePassedCertainPeriod(params: {
206
- // id?: { $eq?: string };
207
- // error: any;
208
- // startDate: { $lt: Date };
209
- // }): Promise<any> {
210
- // return this.actionModel.updateMany(
211
- // {
212
- // actionStatus: { $eq: factory.actionStatusType.ActiveActionStatus },
213
- // // 一定期間過ぎたもの
214
- // startDate: { $lt: params.startDate.$lt },
215
- // ...(typeof params.id?.$eq === 'string') ? { _id: { $eq: params.id.$eq } } : undefined
216
- // },
217
- // {
218
- // actionStatus: factory.actionStatusType.FailedActionStatus,
219
- // error: params.error,
220
- // endDate: new Date()
221
- // }
222
- // )
223
- // .exec();
224
- // }
225
- // public async findById<T extends factory.actionType>(
226
- // params: {
227
- // typeOf: T;
228
- // id: string;
229
- // },
230
- // inclusion?: IKeyOfProjection[],
231
- // exclusion?: IKeyOfProjection[]
232
- // ): Promise<IAction<T>> {
233
- // let positiveProjectionFields: IKeyOfProjection[] = AVAILABLE_PROJECT_FIELDS;
234
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
235
- // positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
236
- // } else {
237
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
238
- // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
239
- // }
240
- // }
241
- // const projection: ProjectionType<IAction<T>> = {
242
- // _id: 0,
243
- // id: { $toString: '$_id' },
244
- // ...Object.fromEntries<1>(positiveProjectionFields.map((key) => ([key, 1])))
245
- // };
246
- // const doc = await this.actionModel.findOne(
247
- // {
248
- // typeOf: { $eq: params.typeOf },
249
- // _id: { $eq: params.id }
250
- // },
251
- // projection
252
- // )
253
- // .lean<IAction<T>>() // 2024-08-26~
254
- // .exec();
255
- // if (doc === null) {
256
- // throw new factory.errors.NotFound(this.actionModel.modelName);
257
- // }
258
- // return doc;
259
- // }
260
- // public async findPayAction(params: {
261
- // project: { id: string };
262
- // paymentMethodId: string;
263
- // actionStatus?: { $in?: factory.actionStatusType[] };
264
- // }): Promise<factory.action.trade.pay.IAction | undefined> {
265
- // const payActions = await this.findActionsByType<factory.actionType.PayAction>(
266
- // {
267
- // limit: 1,
268
- // page: 1,
269
- // actionStatus: (Array.isArray(params.actionStatus?.$in))
270
- // ? { $in: params.actionStatus?.$in }
271
- // : { $in: [factory.actionStatusType.CompletedActionStatus] },
272
- // project: { id: { $eq: params.project.id } },
273
- // typeOf: { $eq: factory.actionType.PayAction },
274
- // object: { paymentMethod: { paymentMethodId: { $eq: params.paymentMethodId } } }
275
- // },
276
- // []
277
- // ) as factory.action.trade.pay.IAction[];
278
- // return payActions.shift();
279
- // }
280
- /**
281
- * 取引に対するアクションを検索する
282
- */
283
- async searchByPurpose(params) {
284
- return (this.findAnyActionsByPurpose(params));
285
- }
286
- /**
287
- * 注文番号から、注文に対するアクションを検索する
288
- */
289
- async searchByOrderNumber(params) {
290
- const filter = {
291
- $or: [
292
- { 'object.orderNumber': { $exists: true, $eq: params.orderNumber } },
293
- { 'purpose.orderNumber': { $exists: true, $eq: params.orderNumber } },
294
- // consider inform returnAction(2025-01-22~)
295
- { 'about.orderNumber': { $exists: true, $eq: params.orderNumber } },
296
- // consider reserveAction,cancelReservationAction(2025-02-17~)
297
- { 'instrument.orderNumber': { $exists: true, $eq: params.orderNumber } }
298
- ]
299
- };
300
- const projection = {
301
- _id: 0,
302
- id: { $toString: '$_id' },
303
- ...Object.fromEntries(actionProcess_1.AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1])))
304
- };
305
- const query = this.actionModel.find(filter, projection);
306
- // .select({ __v: 0, createdAt: 0, updatedAt: 0 });
307
- /* istanbul ignore else */
308
- if (params.sort?.startDate !== undefined) {
309
- query.sort({ startDate: params.sort.startDate });
310
- }
311
- return query
312
- .lean() // 2024-08-26~
313
- .exec();
314
- }
315
- /**
316
- * 注文番号から、注文に対するアクションを削除する
317
- */
318
- async deleteActionsByOrderNumber(params) {
319
- const { project, orderNumber } = params;
320
- if (typeof project.id !== 'string' || project.id === '') {
321
- throw new factory_1.factory.errors.ArgumentNull('project.id');
322
- }
323
- if (typeof orderNumber !== 'string' || orderNumber === '') {
324
- throw new factory_1.factory.errors.ArgumentNull('orderNumber');
325
- }
326
- const filters = [
327
- {
328
- identifier: 'byObject',
329
- filter: {
330
- 'project.id': { $eq: project.id },
331
- 'object.orderNumber': { $exists: true, $eq: orderNumber }
332
- }
333
- },
334
- {
335
- identifier: 'byPurpose',
336
- filter: {
337
- 'project.id': { $eq: project.id },
338
- 'purpose.orderNumber': { $exists: true, $eq: orderNumber }
339
- }
340
- },
341
- {
342
- identifier: 'byAbout',
343
- filter: {
344
- 'project.id': { $eq: project.id },
345
- 'about.orderNumber': { $exists: true, $eq: orderNumber }
346
- }
347
- },
348
- {
349
- identifier: 'byInstrument',
350
- filter: {
351
- 'project.id': { $eq: project.id },
352
- 'instrument.orderNumber': { $exists: true, $eq: orderNumber }
353
- }
354
- },
355
- ];
356
- return Promise.all(filters.map(async ({ identifier, filter }) => {
357
- return this.actionModel.deleteMany(filter)
358
- .exec()
359
- .then((result) => {
360
- return {
361
- identifier,
362
- // n: result?.n,
363
- // opTime: result.opTime,
364
- // ok: result?.ok,
365
- // operationTime,
366
- deletedCount: result?.deletedCount
367
- };
368
- });
369
- }));
370
- }
371
- async deleteByProject(params) {
372
- await this.actionModel.deleteMany({
373
- 'project.id': { $eq: params.project.id }
374
- })
375
- .exec();
376
- }
377
- /**
378
- * 開始日時を一定期間過ぎたアクションを削除する
379
- */
380
- async deleteStartDatePassedCertainPeriod(params) {
381
- return this.actionModel.deleteMany({
382
- startDate: {
383
- $lt: params.$lt
384
- }
385
- })
386
- .exec();
387
- }
388
- /**
389
- * 終了日時を一定期間過ぎたアクションを削除する
390
- * 作成日時を一定期間過ぎたアクションレシピも削除する
391
- */
392
- async deleteEndDatePassedCertainPeriod(params) {
393
- const { $lt } = params;
394
- if ($lt instanceof Date) {
395
- const deleteActionsResult = await this.actionModel.deleteMany({
396
- // 終了日時を一定期間過ぎたもの
397
- endDate: { $exists: true, $lt }
398
- })
399
- .exec();
400
- // clean actionRecipes(2025-01-10~)
401
- const dateCreatedLt = (0, moment_1.default)($lt)
402
- .add(-1, 'day') // レシピ作成とアクション終了の時間差を考慮
403
- .toDate();
404
- const deleteActionRecipesResult = await this.actionRecipeModel.deleteMany({
405
- dateCreated: { $lt: dateCreatedLt }
406
- })
407
- .exec();
408
- return { deleteActionRecipesResult, deleteActionsResult };
409
- }
410
- }
411
- /**
412
- * 取引からアクションを削除する
413
- */
414
- async deleteActionsByTransactionId(params) {
415
- const { project, transaction } = params;
416
- if (typeof project.id !== 'string' || project.id === '') {
417
- throw new factory_1.factory.errors.ArgumentNull('project.id');
418
- }
419
- if (typeof transaction.id !== 'string' || transaction.id === '') {
420
- throw new factory_1.factory.errors.ArgumentNull('transaction.id ');
421
- }
422
- const filters = [
423
- {
424
- identifier: 'byPurpose',
425
- filter: {
426
- 'project.id': { $eq: project.id },
427
- typeOf: { $in: params.typeOf.$in },
428
- 'purpose.id': { $exists: true, $eq: transaction.id },
429
- 'purpose.typeOf': { $exists: true, $eq: transaction.typeOf }
430
- }
431
- },
432
- // instrumentによるアクション削除にも対応(2026-07-10~)
433
- {
434
- identifier: 'byInstrument',
435
- filter: {
436
- 'project.id': { $eq: project.id },
437
- // typeOf: { $in: params.typeOf.$in }, // typOfでフィルターしない
438
- 'instrument.id': { $exists: true, $eq: transaction.id },
439
- 'instrument.typeOf': { $exists: true, $eq: transaction.typeOf }
440
- }
441
- }
442
- ];
443
- return Promise.all(filters.map(async ({ identifier, filter }) => {
444
- return this.actionModel.deleteMany(filter)
445
- .exec()
446
- .then((result) => {
447
- return {
448
- identifier,
449
- // n: result?.n,
450
- // opTime: result.opTime,
451
- // ok: result?.ok,
452
- // operationTime,
453
- deletedCount: result?.deletedCount
454
- };
455
- });
456
- }));
457
- }
458
- getCursor(conditions, projection) {
459
- return this.actionModel.find(conditions, projection)
460
- .sort({ startDate: factory_1.factory.sortType.Descending })
461
- .cursor();
462
- }
463
- async unsetUnnecessaryFields(params) {
464
- return this.actionModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
465
- .exec();
466
- }
467
- }
468
- exports.ActionRepo = ActionRepo;
@@ -1,23 +0,0 @@
1
- import type { Connection, UpdateWriteOpResult } from 'mongoose';
2
- import { INextFunction } from '../eventEmitter/task';
3
- import { factory } from '../factory';
4
- /**
5
- * 旧非同期アクション(tasksコレクションにて管理)リポジトリ
6
- */
7
- export declare class AsyncActionLegacyRepo {
8
- private readonly taskModel;
9
- constructor(connection: Connection);
10
- runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
11
- alternateName?: never;
12
- identifier?: never;
13
- expires: Date;
14
- }, next: INextFunction): Promise<{
15
- id: string;
16
- }>;
17
- /**
18
- * Readyのままで期限切れのタスクをExpiredに変更する
19
- */
20
- makeExpiredMany(params: {
21
- expiresLt: Date;
22
- }): Promise<UpdateWriteOpResult>;
23
- }