@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,11 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.AdminTaskRepo = void 0;
7
+ const moment_1 = __importDefault(require("moment"));
4
8
  const factory_1 = require("../factory");
5
9
  const settings_1 = require("../settings");
6
10
  const task_1 = require("./mongoose/schemas/task");
7
11
  const AVAILABLE_PROJECT_FIELDS = [
8
- 'alternateName',
9
12
  'identifier',
10
13
  'description',
11
14
  'project',
@@ -19,7 +22,7 @@ const AVAILABLE_PROJECT_FIELDS = [
19
22
  'executor',
20
23
  'data',
21
24
  'dateAborted',
22
- 'expires'
25
+ // 'expires' // 非同期アクションは移行につきexpires廃止(2026-08-05~)
23
26
  ];
24
27
  /**
25
28
  * タスク管理リポジトリ
@@ -65,12 +68,12 @@ class AdminTaskRepo {
65
68
  if (params.runsThrough instanceof Date) {
66
69
  andConditions.push({ runsAt: { $lte: params.runsThrough } });
67
70
  }
68
- if (params.lastTriedFrom instanceof Date) {
69
- andConditions.push({ lastTriedAt: { $type: 'date', $gte: params.lastTriedFrom } });
70
- }
71
- if (params.lastTriedThrough instanceof Date) {
72
- andConditions.push({ lastTriedAt: { $type: 'date', $lte: params.lastTriedThrough } });
73
- }
71
+ // if (params.lastTriedFrom instanceof Date) {
72
+ // andConditions.push({ lastTriedAt: { $type: 'date', $gte: params.lastTriedFrom } });
73
+ // }
74
+ // if (params.lastTriedThrough instanceof Date) {
75
+ // andConditions.push({ lastTriedAt: { $type: 'date', $lte: params.lastTriedThrough } });
76
+ // }
74
77
  const dateAbortedGte = params.dateAborted?.$gte;
75
78
  if (dateAbortedGte instanceof Date) {
76
79
  andConditions.push({ dateAborted: { $type: 'date', $gte: dateAbortedGte } });
@@ -79,30 +82,6 @@ class AdminTaskRepo {
79
82
  if (dateAbortedLte instanceof Date) {
80
83
  andConditions.push({ dateAborted: { $type: 'date', $lte: dateAbortedLte } });
81
84
  }
82
- const objectIdEq = params.data?.object?.id?.$eq;
83
- if (typeof objectIdEq === 'string') {
84
- andConditions.push({ 'data.object.id': { $exists: true, $eq: objectIdEq } });
85
- }
86
- const objectOrderNumberEq = params.data?.object?.orderNumber?.$eq;
87
- if (typeof objectOrderNumberEq === 'string') {
88
- andConditions.push({ 'data.object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
89
- }
90
- const objectTransactionNumberEq = params.data?.object?.transactionNumber?.$eq;
91
- if (typeof objectTransactionNumberEq === 'string') {
92
- andConditions.push({ 'data.object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
93
- }
94
- const objectPurposeIdEq = params.data?.purpose?.id?.$eq;
95
- if (typeof objectPurposeIdEq === 'string') {
96
- andConditions.push({ 'data.purpose.id': { $exists: true, $eq: objectPurposeIdEq } });
97
- }
98
- const objectPurposeOrderNumberEq = params.data?.purpose?.orderNumber?.$eq;
99
- if (typeof objectPurposeOrderNumberEq === 'string') {
100
- andConditions.push({ 'data.purpose.orderNumber': { $exists: true, $eq: objectPurposeOrderNumberEq } });
101
- }
102
- const alternateNameRegex = params.alternateName?.$regex;
103
- if (typeof alternateNameRegex === 'string' && alternateNameRegex.length > 0) {
104
- andConditions.push({ alternateName: { $exists: true, $regex: new RegExp(alternateNameRegex) } });
105
- }
106
85
  const identifierRegex = params.identifier?.$regex;
107
86
  if (typeof identifierRegex === 'string' && identifierRegex.length > 0) {
108
87
  andConditions.push({ identifier: { $exists: true, $regex: new RegExp(identifierRegex) } });
@@ -150,6 +129,26 @@ class AdminTaskRepo {
150
129
  .lean() // lean(2024-09-26~)
151
130
  .exec();
152
131
  }
132
+ /**
133
+ * cron:notifyLatency専用
134
+ */
135
+ async countDelayedTasks(params) {
136
+ const { limit } = params;
137
+ const runsAtLt = (0, moment_1.default)()
138
+ .add(-params.delayInSeconds, 'seconds')
139
+ .toDate();
140
+ const query = this.taskModel.countDocuments({
141
+ status: { $eq: factory_1.factory.taskStatus.Ready },
142
+ runsAt: { $lt: runsAtLt },
143
+ ...(Array.isArray(params.name.$nin)) ? { name: { $nin: params.name.$nin } } : undefined
144
+ });
145
+ if (typeof limit === 'number' && limit >= 0) {
146
+ query.limit(limit);
147
+ }
148
+ const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
149
+ .exec();
150
+ return { count };
151
+ }
153
152
  getCursor(conditions, projection) {
154
153
  return this.taskModel.find(conditions, projection)
155
154
  .sort({ runsAt: factory_1.factory.sortType.Ascending })
@@ -0,0 +1,131 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ import { IDocType } from './mongoose/schemas/transaction';
4
+ /**
5
+ * 取引管理リポジトリ
6
+ */
7
+ export declare class AdminTransactionRepo {
8
+ private readonly transactionModel;
9
+ constructor(connection: Connection);
10
+ countPotentiallyExportTasks(params: {
11
+ endDate: {
12
+ $lt: Date;
13
+ };
14
+ limit?: number;
15
+ }): Promise<{
16
+ count: number;
17
+ }>;
18
+ /**
19
+ * tasksExportAction.actionStatusがActiveActionStatusのまま一定時間経過した取引について
20
+ * PotentialActionStatusに変更する
21
+ * 2025-03-10~
22
+ */
23
+ reExportAction(params: {
24
+ startDate: {
25
+ $lt: Date;
26
+ };
27
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
28
+ /**
29
+ * add(2025-03-13~)
30
+ */
31
+ countPotentiallyExpired(params: {
32
+ expires: {
33
+ $lt: Date;
34
+ };
35
+ limit?: number;
36
+ }): Promise<{
37
+ count: number;
38
+ }>;
39
+ /**
40
+ * add(2025-03-03~)
41
+ */
42
+ makeOneExpiredIfExists(params: {
43
+ expires: {
44
+ $lt: Date;
45
+ };
46
+ }): Promise<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'> | undefined>;
47
+ findByIdAndDelete(params: {
48
+ id: string;
49
+ }): Promise<void>;
50
+ unsetUnnecessaryFields(params: {
51
+ filter: any;
52
+ $unset: any;
53
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
54
+ getCursor(conditions: any, projection: any, sort?: factory.sortType): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
55
+ object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
56
+ error?: any;
57
+ project: import("@chevre/factory/lib/chevre/transaction").IProject;
58
+ seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
59
+ typeOf: factory.transactionType.PlaceOrder;
60
+ expires: Date;
61
+ result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
62
+ startDate: Date;
63
+ endDate?: Date | undefined;
64
+ instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
65
+ agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
66
+ status: factory.transactionStatusType;
67
+ tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
68
+ potentialActions?: undefined;
69
+ } & {
70
+ _id: import("mongoose").Types.ObjectId;
71
+ } & {
72
+ __v: number;
73
+ }) | ({
74
+ object: import("@chevre/factory/lib/chevre/transaction/returnOrder").IObject;
75
+ error?: any;
76
+ project: import("@chevre/factory/lib/chevre/transaction").IProject;
77
+ seller: import("@chevre/factory/lib/chevre/transaction").ISeller;
78
+ typeOf: factory.transactionType.ReturnOrder;
79
+ expires: Date;
80
+ result?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IResult | undefined;
81
+ startDate: Date;
82
+ endDate?: Date | undefined;
83
+ agent: import("@chevre/factory/lib/chevre/transaction").IAgent;
84
+ recipient?: undefined;
85
+ status: factory.transactionStatusType;
86
+ tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
87
+ potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
88
+ } & {
89
+ _id: import("mongoose").Types.ObjectId;
90
+ } & {
91
+ __v: number;
92
+ })), import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
93
+ object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
94
+ error?: any;
95
+ project: import("@chevre/factory/lib/chevre/transaction").IProject;
96
+ seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
97
+ typeOf: factory.transactionType.PlaceOrder;
98
+ expires: Date;
99
+ result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
100
+ startDate: Date;
101
+ endDate?: Date | undefined;
102
+ instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
103
+ agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
104
+ status: factory.transactionStatusType;
105
+ tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
106
+ potentialActions?: undefined;
107
+ } & {
108
+ _id: import("mongoose").Types.ObjectId;
109
+ } & {
110
+ __v: number;
111
+ }) | ({
112
+ object: import("@chevre/factory/lib/chevre/transaction/returnOrder").IObject;
113
+ error?: any;
114
+ project: import("@chevre/factory/lib/chevre/transaction").IProject;
115
+ seller: import("@chevre/factory/lib/chevre/transaction").ISeller;
116
+ typeOf: factory.transactionType.ReturnOrder;
117
+ expires: Date;
118
+ result?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IResult | undefined;
119
+ startDate: Date;
120
+ endDate?: Date | undefined;
121
+ agent: import("@chevre/factory/lib/chevre/transaction").IAgent;
122
+ recipient?: undefined;
123
+ status: factory.transactionStatusType;
124
+ tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
125
+ potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
126
+ } & {
127
+ _id: import("mongoose").Types.ObjectId;
128
+ } & {
129
+ __v: number;
130
+ }))) | null>;
131
+ }
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminTransactionRepo = void 0;
4
+ const transaction_1 = require("../eventEmitter/transaction");
5
+ const factory_1 = require("../factory");
6
+ const settings_1 = require("../settings");
7
+ const transaction_2 = require("./mongoose/schemas/transaction");
8
+ /**
9
+ * 取引管理リポジトリ
10
+ */
11
+ class AdminTransactionRepo {
12
+ transactionModel;
13
+ constructor(connection) {
14
+ this.transactionModel = connection.model(transaction_2.modelName, (0, transaction_2.createSchema)());
15
+ }
16
+ async countPotentiallyExportTasks(params) {
17
+ const { endDate, limit } = params;
18
+ const endDateLt = endDate?.$lt;
19
+ if (!(endDateLt instanceof Date)) {
20
+ throw new factory_1.factory.errors.Argument('endDate.$lt', 'must be Date');
21
+ }
22
+ const query = this.transactionModel.countDocuments({
23
+ status: {
24
+ $in: [
25
+ factory_1.factory.transactionStatusType.Canceled,
26
+ factory_1.factory.transactionStatusType.Confirmed,
27
+ factory_1.factory.transactionStatusType.Expired
28
+ ]
29
+ },
30
+ 'tasksExportAction.actionStatus': {
31
+ $exists: true,
32
+ $eq: factory_1.factory.actionStatusType.PotentialActionStatus
33
+ },
34
+ endDate: { $exists: true, $lt: endDateLt }
35
+ });
36
+ if (typeof limit === 'number' && limit >= 0) {
37
+ query.limit(limit);
38
+ }
39
+ const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
40
+ .exec();
41
+ return { count };
42
+ }
43
+ /**
44
+ * tasksExportAction.actionStatusがActiveActionStatusのまま一定時間経過した取引について
45
+ * PotentialActionStatusに変更する
46
+ * 2025-03-10~
47
+ */
48
+ async reExportAction(params) {
49
+ const { startDate } = params;
50
+ if (!(startDate.$lt instanceof Date)) {
51
+ throw new factory_1.factory.errors.Argument('startDate.$lt', 'must be Date');
52
+ }
53
+ return this.transactionModel.updateMany({
54
+ 'tasksExportAction.actionStatus': {
55
+ $exists: true,
56
+ $eq: factory_1.factory.actionStatusType.ActiveActionStatus
57
+ },
58
+ 'tasksExportAction.startDate': {
59
+ $exists: true,
60
+ $lt: startDate.$lt
61
+ }
62
+ }, {
63
+ $set: {
64
+ tasksExportAction: {
65
+ actionStatus: factory_1.factory.actionStatusType.PotentialActionStatus
66
+ }
67
+ }
68
+ })
69
+ .exec();
70
+ }
71
+ // /**
72
+ // * タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
73
+ // */
74
+ // public async exportTasksMany(params: {
75
+ // now: Date;
76
+ // delayInSeconds: number;
77
+ // status: {
78
+ // $in: factory.transactionStatusType[];
79
+ // };
80
+ // limit: number;
81
+ // }) {
82
+ // const delayedTransactions = await this.transactionModel.find({
83
+ // status: { $in: params.status.$in },
84
+ // 'tasksExportAction.actionStatus': {
85
+ // $exists: true,
86
+ // $eq: factory.actionStatusType.PotentialActionStatus
87
+ // },
88
+ // endDate: {
89
+ // $exists: true,
90
+ // $lt: moment(params.now)
91
+ // .add(-params.delayInSeconds, 'seconds')
92
+ // .toDate()
93
+ // }
94
+ // })
95
+ // .select({
96
+ // _id: 0,
97
+ // id: { $toString: '$_id' },
98
+ // typeOf: 1,
99
+ // status: 1
100
+ // })
101
+ // .limit(params.limit)
102
+ // .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
103
+ // .lean<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'status' | 'typeOf'>[]>()
104
+ // .exec();
105
+ // if (delayedTransactions.length > 0) {
106
+ // delayedTransactions.forEach((delayedTransaction) => {
107
+ // transactionEventEmitter.emitTransactionStatusChanged({
108
+ // id: delayedTransaction.id,
109
+ // typeOf: delayedTransaction.typeOf,
110
+ // status: delayedTransaction.status
111
+ // });
112
+ // });
113
+ // }
114
+ // return delayedTransactions;
115
+ // }
116
+ /**
117
+ * add(2025-03-13~)
118
+ */
119
+ async countPotentiallyExpired(params) {
120
+ const { expires, limit } = params;
121
+ const query = this.transactionModel.countDocuments({
122
+ status: { $eq: factory_1.factory.transactionStatusType.InProgress },
123
+ expires: { $lt: expires.$lt }
124
+ });
125
+ if (typeof limit === 'number' && limit >= 0) {
126
+ query.limit(limit);
127
+ }
128
+ const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
129
+ .exec();
130
+ return { count };
131
+ }
132
+ /**
133
+ * add(2025-03-03~)
134
+ */
135
+ async makeOneExpiredIfExists(params) {
136
+ const endDate = new Date();
137
+ const sort = {
138
+ expires: factory_1.factory.sortType.Ascending
139
+ };
140
+ const doc = await this.transactionModel.findOneAndUpdate({
141
+ status: { $eq: factory_1.factory.transactionStatusType.InProgress },
142
+ expires: { $lt: params.expires.$lt }
143
+ }, {
144
+ status: factory_1.factory.transactionStatusType.Expired,
145
+ endDate
146
+ }, {
147
+ new: true,
148
+ projection: {
149
+ _id: 0,
150
+ id: { $toString: '$_id' },
151
+ typeOf: 1
152
+ }
153
+ })
154
+ .sort(sort)
155
+ .lean()
156
+ .exec();
157
+ if (doc === null) {
158
+ // no op
159
+ return;
160
+ }
161
+ else {
162
+ transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
163
+ id: doc.id,
164
+ typeOf: doc.typeOf,
165
+ status: factory_1.factory.transactionStatusType.Expired
166
+ });
167
+ return doc;
168
+ }
169
+ }
170
+ // /**
171
+ // * 取引を期限切れにする
172
+ // */
173
+ // public async makeExpired(params: {
174
+ // expires: { $lt: Date };
175
+ // limit: number; // add limit(2025-02-27~)
176
+ // }): Promise<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'>[]> {
177
+ // if (typeof params.limit !== 'number' || params.limit === 0) {
178
+ // throw new factory.errors.ArgumentNull('limit');
179
+ // }
180
+ // const sort: { [key in keyof factory.transaction.ITransaction<factory.transactionType>]?: factory.sortType } = {
181
+ // expires: factory.sortType.Ascending
182
+ // };
183
+ // // IDをemitしたいのでまずリスト検索(2023-04-27~)
184
+ // const expiringTransactions =
185
+ // await this.transactionModel.find({
186
+ // status: { $eq: factory.transactionStatusType.InProgress },
187
+ // expires: { $lt: params.expires.$lt }
188
+ // })
189
+ // .select({
190
+ // _id: 0,
191
+ // id: { $toString: '$_id' },
192
+ // typeOf: 1
193
+ // })
194
+ // .limit(params.limit)
195
+ // .sort(sort) // sort(2025-03-03~)
196
+ // .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
197
+ // .lean<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'>[]>()
198
+ // .exec();
199
+ // if (expiringTransactions.length > 0) {
200
+ // // ステータスと期限を見て更新
201
+ // await this.transactionModel.updateMany(
202
+ // {
203
+ // _id: { $in: expiringTransactions.map((t) => t.id) },
204
+ // status: { $eq: factory.transactionStatusType.InProgress },
205
+ // expires: { $lt: params.expires.$lt }
206
+ // },
207
+ // {
208
+ // status: factory.transactionStatusType.Expired,
209
+ // endDate: new Date()
210
+ // }
211
+ // )
212
+ // .exec();
213
+ // expiringTransactions.forEach((expiringTransaction) => {
214
+ // transactionEventEmitter.emitTransactionStatusChanged({
215
+ // id: expiringTransaction.id,
216
+ // typeOf: expiringTransaction.typeOf,
217
+ // status: factory.transactionStatusType.Expired
218
+ // });
219
+ // });
220
+ // }
221
+ // return expiringTransactions;
222
+ // }
223
+ async findByIdAndDelete(params) {
224
+ await this.transactionModel.findByIdAndDelete(params.id)
225
+ .exec();
226
+ }
227
+ async unsetUnnecessaryFields(params) {
228
+ return this.transactionModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
229
+ .exec();
230
+ }
231
+ getCursor(conditions, projection, sort) {
232
+ return this.transactionModel.find(conditions, projection)
233
+ .sort({ startDate: (sort === factory_1.factory.sortType.Ascending) ? sort : factory_1.factory.sortType.Descending })
234
+ .cursor();
235
+ }
236
+ }
237
+ exports.AdminTransactionRepo = AdminTransactionRepo;
@@ -1,6 +1,6 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
- interface IAggregationByStatus {
3
+ export interface IAggregationByStatus {
4
4
  actionCount: number;
5
5
  avgDuration: number;
6
6
  maxDuration: number;
@@ -10,23 +10,20 @@ interface IAggregationByStatus {
10
10
  value: number;
11
11
  }[];
12
12
  }
13
- interface IStatus {
13
+ export interface IStatus {
14
14
  status: factory.actionStatusType;
15
15
  aggregation: IAggregationByStatus;
16
16
  }
17
- interface IAggregateAction {
17
+ export interface IAggregateAction {
18
18
  statuses: IStatus[];
19
19
  }
20
+ type IAvailableActionType = Exclude<factory.actionType, factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction | factory.actionType.InformAction | factory.actionType.UseAction>;
20
21
  /**
21
22
  * アクション集計リポジトリ
22
23
  */
23
24
  export declare class AggregateActionRepo {
24
25
  private readonly actionModel;
25
26
  constructor(connection: Connection);
26
- /**
27
- * イベントと入場ゲート指定で予約使用アクションを集計する
28
- * discontinue(2024-12-26~)
29
- */
30
27
  aggregateAuthorizeEventServiceOfferAction(params: {
31
28
  project?: {
32
29
  id?: {
@@ -35,7 +32,7 @@ export declare class AggregateActionRepo {
35
32
  };
36
33
  startFrom: Date;
37
34
  startThrough: Date;
38
- typeOf: factory.actionType;
35
+ typeOf: factory.actionType.AuthorizeAction;
39
36
  }): Promise<IAggregateAction>;
40
37
  aggregateAuthorizePaymentAction(params: {
41
38
  project?: {
@@ -45,7 +42,7 @@ export declare class AggregateActionRepo {
45
42
  };
46
43
  startFrom: Date;
47
44
  startThrough: Date;
48
- typeOf: factory.actionType;
45
+ typeOf: factory.actionType.AuthorizeAction;
49
46
  }): Promise<IAggregateAction>;
50
47
  aggregateAuthorizeOrderAction(params: {
51
48
  project?: {
@@ -55,7 +52,7 @@ export declare class AggregateActionRepo {
55
52
  };
56
53
  startFrom: Date;
57
54
  startThrough: Date;
58
- typeOf: factory.actionType;
55
+ typeOf: factory.actionType.AuthorizeAction;
59
56
  }): Promise<IAggregateAction>;
60
57
  aggregateCancelReservationAction(params: {
61
58
  project?: {
@@ -77,7 +74,7 @@ export declare class AggregateActionRepo {
77
74
  };
78
75
  startFrom: Date;
79
76
  startThrough: Date;
80
- typeOf: factory.actionType;
77
+ typeOf: IAvailableActionType;
81
78
  }): Promise<IAggregateAction>;
82
79
  aggregateCheckMovieTicketAction(params: {
83
80
  project?: {
@@ -9,70 +9,9 @@ const action_1 = require("./mongoose/schemas/action");
9
9
  */
10
10
  class AggregateActionRepo {
11
11
  actionModel;
12
- // private readonly actionRecipeModel: IActionRecipeModel;
13
12
  constructor(connection) {
14
13
  this.actionModel = connection.model(action_1.modelName, (0, action_1.createSchema)());
15
14
  }
16
- /**
17
- * イベントと入場ゲート指定で予約使用アクションを集計する
18
- * discontinue(2024-12-26~)
19
- */
20
- // public async countUseActionsByEntranceGate(params: {
21
- // event: { id: string };
22
- // entranceGateIdentifier: string;
23
- // }): Promise<IUseActionCountByOffer[]> {
24
- // return this.actionModel.aggregate([
25
- // {
26
- // $match: {
27
- // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
28
- // }
29
- // },
30
- // {
31
- // $match: {
32
- // typeOf: { $eq: factory.actionType.UseAction }
33
- // }
34
- // },
35
- // {
36
- // $match: {
37
- // 'object.typeOf': {
38
- // $exists: true,
39
- // $eq: factory.reservationType.EventReservation
40
- // }
41
- // }
42
- // },
43
- // {
44
- // $match: {
45
- // 'object.reservationFor.id': {
46
- // $exists: true,
47
- // $eq: params.event.id
48
- // }
49
- // }
50
- // },
51
- // {
52
- // $match: {
53
- // 'location.identifier': {
54
- // $exists: true,
55
- // $eq: params.entranceGateIdentifier
56
- // }
57
- // }
58
- // },
59
- // {
60
- // $group: {
61
- // _id: '$object.id',
62
- // object: { $first: '$object' }
63
- // }
64
- // },
65
- // {
66
- // $group: {
67
- // _id: '$object.reservedTicket.ticketType.id',
68
- // useActionCount: {
69
- // $sum: 1
70
- // }
71
- // }
72
- // }
73
- // ])
74
- // .exec();
75
- // }
76
15
  async aggregateAuthorizeEventServiceOfferAction(params) {
77
16
  const statuses = await Promise.all([
78
17
  factory_1.factory.actionStatusType.CompletedActionStatus,
@@ -0,0 +1,43 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ interface IAggregationByStatus {
4
+ transactionCount: number;
5
+ avgDuration: number;
6
+ maxDuration: number;
7
+ minDuration: number;
8
+ percentilesDuration: {
9
+ name: string;
10
+ value: number;
11
+ }[];
12
+ reservationCount: number;
13
+ avgGraceTime: number;
14
+ maxGraceTime: number;
15
+ minGraceTime: number;
16
+ }
17
+ interface IStatus {
18
+ status: factory.transactionStatusType;
19
+ aggregation: IAggregationByStatus;
20
+ }
21
+ export interface IAggregateReserve {
22
+ statuses: IStatus[];
23
+ }
24
+ /**
25
+ * 資産取引集計リポジトリ
26
+ */
27
+ export declare class AggregateAssetTransactionRepo {
28
+ private readonly transactionModel;
29
+ constructor(connection: Connection);
30
+ aggregateAssetTransaction(params: {
31
+ project?: {
32
+ id?: {
33
+ $eq?: string;
34
+ $ne?: string;
35
+ };
36
+ };
37
+ startFrom: Date;
38
+ startThrough: Date;
39
+ typeOf: factory.assetTransactionType;
40
+ }): Promise<IAggregateReserve>;
41
+ private agggregateByStatus;
42
+ }
43
+ export {};