@chevre/domain 26.0.0-alpha.9 → 26.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) 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 +11 -1
  6. package/lib/chevre/repo/action/acceptCOAOffer.js +25 -2
  7. package/lib/chevre/repo/action/acceptPay.d.ts +11 -1
  8. package/lib/chevre/repo/action/acceptPay.js +27 -6
  9. package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +111 -0
  10. package/lib/chevre/repo/action/anyAction/actionProcess.js +290 -0
  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 +8 -5
  15. package/lib/chevre/repo/action/authorizeOffer.d.ts +3 -1
  16. package/lib/chevre/repo/action/authorizeOffer.js +8 -7
  17. package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +11 -1
  18. package/lib/chevre/repo/action/authorizePaymentMethod.js +25 -5
  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 +11 -1
  24. package/lib/chevre/repo/action/checkMovieTicket.js +25 -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/dedicatedAction/dedicatedActionProcess.d.ts +46 -0
  30. package/lib/chevre/repo/action/dedicatedAction/dedicatedActionProcess.js +92 -0
  31. package/lib/chevre/repo/action/inform.d.ts +39 -0
  32. package/lib/chevre/repo/action/inform.js +115 -0
  33. package/lib/chevre/repo/action/order.d.ts +21 -0
  34. package/lib/chevre/repo/action/order.js +35 -0
  35. package/lib/chevre/repo/action/pay.d.ts +3 -1
  36. package/lib/chevre/repo/action/pay.js +8 -5
  37. package/lib/chevre/repo/action/refund.d.ts +3 -1
  38. package/lib/chevre/repo/action/refund.js +7 -4
  39. package/lib/chevre/repo/action/reserve.d.ts +21 -0
  40. package/lib/chevre/repo/action/reserve.js +37 -0
  41. package/lib/chevre/repo/action/returnAction.d.ts +11 -0
  42. package/lib/chevre/repo/action/returnAction.js +16 -0
  43. package/lib/chevre/repo/action/sendEmailMessage.d.ts +10 -0
  44. package/lib/chevre/repo/action/sendEmailMessage.js +17 -0
  45. package/lib/chevre/repo/action/sendOrder.d.ts +10 -0
  46. package/lib/chevre/repo/action/sendOrder.js +16 -0
  47. package/lib/chevre/repo/action/unknown2actionError.d.ts +6 -0
  48. package/lib/chevre/repo/action/unknown2actionError.js +15 -0
  49. package/lib/chevre/repo/action/update.d.ts +50 -0
  50. package/lib/chevre/repo/action/update.js +129 -0
  51. package/lib/chevre/repo/action/use.d.ts +40 -0
  52. package/lib/chevre/repo/action/use.js +122 -0
  53. package/lib/chevre/repo/{action.d.ts → adminAction.d.ts} +11 -37
  54. package/lib/chevre/repo/adminAction.js +202 -0
  55. package/lib/chevre/repo/adminAssetTransaction.d.ts +126 -0
  56. package/lib/chevre/repo/adminAssetTransaction.js +491 -0
  57. package/lib/chevre/repo/adminScheduledTask.d.ts +1 -1
  58. package/lib/chevre/repo/adminTask.d.ts +25 -8
  59. package/lib/chevre/repo/adminTask.js +31 -32
  60. package/lib/chevre/repo/adminTransaction.d.ts +131 -0
  61. package/lib/chevre/repo/adminTransaction.js +237 -0
  62. package/lib/chevre/repo/aggregateAction.d.ts +8 -11
  63. package/lib/chevre/repo/aggregateAction.js +0 -61
  64. package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
  65. package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
  66. package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
  67. package/lib/chevre/repo/aggregateTransaction.js +166 -0
  68. package/lib/chevre/repo/aggregateUseAction.d.ts +35 -0
  69. package/lib/chevre/repo/aggregateUseAction.js +164 -0
  70. package/lib/chevre/repo/aggregation.d.ts +0 -8
  71. package/lib/chevre/repo/aggregation.js +0 -10
  72. package/lib/chevre/repo/assetTransaction.d.ts +10 -235
  73. package/lib/chevre/repo/assetTransaction.js +48 -636
  74. package/lib/chevre/repo/authorization.d.ts +0 -6
  75. package/lib/chevre/repo/authorization.js +15 -27
  76. package/lib/chevre/repo/factory/action/createMongoConditions.d.ts +4 -0
  77. package/lib/chevre/repo/factory/action/createMongoConditions.js +335 -0
  78. package/lib/chevre/repo/message.d.ts +0 -7
  79. package/lib/chevre/repo/message.js +0 -38
  80. package/lib/chevre/repo/migrateAction.d.ts +48 -0
  81. package/lib/chevre/repo/migrateAction.js +32 -0
  82. package/lib/chevre/repo/mongoose/schemas/action/abstractAction.d.ts +5 -0
  83. package/lib/chevre/repo/mongoose/schemas/action/abstractAction.js +2 -0
  84. package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +11 -0
  85. package/lib/chevre/repo/mongoose/schemas/action/inform.js +82 -0
  86. package/lib/chevre/repo/mongoose/schemas/action/update.d.ts +12 -0
  87. package/lib/chevre/repo/mongoose/schemas/action/update.js +112 -0
  88. package/lib/chevre/repo/mongoose/schemas/{ownershipInfo.d.ts → action/use.d.ts} +4 -6
  89. package/lib/chevre/repo/mongoose/schemas/action/use.js +92 -0
  90. package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -3
  91. package/lib/chevre/repo/mongoose/schemas/action.js +22 -7
  92. package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +1 -0
  93. package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +19 -1
  94. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
  95. package/lib/chevre/repo/mongoose/schemas/aggregation.js +8 -1
  96. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +95 -76
  97. package/lib/chevre/repo/mongoose/schemas/authorization.js +25 -18
  98. package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
  99. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
  100. package/lib/chevre/repo/mongoose/schemas/message.js +8 -1
  101. package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
  102. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +5 -16
  103. package/lib/chevre/repo/mongoose/schemas/task.d.ts +2 -5
  104. package/lib/chevre/repo/mongoose/schemas/task.js +134 -118
  105. package/lib/chevre/repo/mongoose/schemas/ticket.js +8 -1
  106. package/lib/chevre/repo/orderInTransaction.d.ts +0 -3
  107. package/lib/chevre/repo/orderInTransaction.js +30 -22
  108. package/lib/chevre/repo/scheduledTask.d.ts +4 -1
  109. package/lib/chevre/repo/scheduledTask.js +3 -25
  110. package/lib/chevre/repo/task.d.ts +44 -155
  111. package/lib/chevre/repo/task.js +13 -555
  112. package/lib/chevre/repo/taskDelayed.d.ts +74 -0
  113. package/lib/chevre/repo/taskDelayed.js +195 -0
  114. package/lib/chevre/repo/taskRunning.d.ts +35 -0
  115. package/lib/chevre/repo/taskRunning.js +89 -0
  116. package/lib/chevre/repo/ticket.d.ts +0 -6
  117. package/lib/chevre/repo/ticket.js +0 -11
  118. package/lib/chevre/repo/transaction.d.ts +1 -187
  119. package/lib/chevre/repo/transaction.js +2 -383
  120. package/lib/chevre/repository.d.ts +65 -25
  121. package/lib/chevre/repository.js +144 -56
  122. package/lib/chevre/service/aggregation/system.d.ts +9 -8
  123. package/lib/chevre/service/aggregation/system.js +5 -5
  124. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
  125. package/lib/chevre/service/assetTransaction/pay/check.d.ts +3 -1
  126. package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +0 -10
  127. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -2
  128. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -2
  129. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -2
  130. package/lib/chevre/service/assetTransaction/refund.d.ts +0 -1
  131. package/lib/chevre/service/assetTransaction/refund.js +2 -2
  132. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +4 -2
  133. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +4 -2
  134. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +8 -4
  135. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -1
  136. package/lib/chevre/service/asyncAction.d.ts +2 -2
  137. package/lib/chevre/service/asyncAction.js +1 -4
  138. package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +2 -2
  139. package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +0 -2
  140. package/lib/chevre/service/asyncActionHandler.d.ts +4 -4
  141. package/lib/chevre/service/asyncActionHandler.js +11 -13
  142. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +4 -2
  143. package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
  144. package/lib/chevre/service/event.d.ts +4 -2
  145. package/lib/chevre/service/event.js +3 -3
  146. package/lib/chevre/service/notification/sendEmailMessage.d.ts +4 -2
  147. package/lib/chevre/service/notification/sendEmailMessage.js +3 -3
  148. package/lib/chevre/service/notification/triggerWebhook.d.ts +4 -2
  149. package/lib/chevre/service/notification/triggerWebhook.js +5 -16
  150. package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
  151. package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +0 -1
  152. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +4 -2
  153. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
  154. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +9 -5
  155. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
  156. package/lib/chevre/service/offer/event/voidTransaction.d.ts +6 -4
  157. package/lib/chevre/service/offer/event/voidTransaction.js +7 -9
  158. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +6 -4
  159. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -15
  160. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
  161. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
  162. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +0 -4
  163. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +23 -24
  164. package/lib/chevre/service/offer/onEventChanged.js +0 -2
  165. package/lib/chevre/service/order/confirmPayTransaction.d.ts +4 -10
  166. package/lib/chevre/service/order/confirmPayTransaction.js +7 -11
  167. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
  168. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +2 -56
  169. package/lib/chevre/service/order/deleteOrder.d.ts +2 -2
  170. package/lib/chevre/service/order/deleteOrder.js +1 -2
  171. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
  172. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
  173. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +2 -4
  174. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +2 -4
  175. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +2 -2
  176. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
  177. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +1 -9
  178. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
  179. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +4 -8
  180. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
  181. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -11
  182. package/lib/chevre/service/order/onOrderUpdated/factory.js +0 -3
  183. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +4 -2
  184. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
  185. package/lib/chevre/service/order/placeOrder.d.ts +6 -4
  186. package/lib/chevre/service/order/placeOrder.js +9 -17
  187. package/lib/chevre/service/order/returnOrder.d.ts +4 -4
  188. package/lib/chevre/service/order/returnOrder.js +11 -43
  189. package/lib/chevre/service/order/sendOrder.d.ts +4 -6
  190. package/lib/chevre/service/order/sendOrder.js +30 -72
  191. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +0 -1
  192. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +0 -1
  193. package/lib/chevre/service/payment/any/authorize.d.ts +1 -2
  194. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +0 -4
  195. package/lib/chevre/service/payment/any/findAcceptAction.js +23 -24
  196. package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +0 -4
  197. package/lib/chevre/service/payment/any/findAuthorizeAction.js +23 -24
  198. package/lib/chevre/service/payment/any/findCheckAction.d.ts +3 -5
  199. package/lib/chevre/service/payment/any/findCheckAction.js +24 -25
  200. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +0 -1
  201. package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +0 -1
  202. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
  203. package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +0 -1
  204. package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +0 -1
  205. package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
  206. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -2
  207. package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -2
  208. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +0 -1
  209. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +0 -1
  210. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +0 -1
  211. package/lib/chevre/service/payment/creditCard/authorize.d.ts +0 -1
  212. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +0 -1
  213. package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +0 -1
  214. package/lib/chevre/service/payment/faceToFace.d.ts +0 -2
  215. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -2
  216. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +3 -1
  217. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +3 -3
  218. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +0 -1
  219. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +0 -1
  220. package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -1
  221. package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
  222. package/lib/chevre/service/project.d.ts +0 -6
  223. package/lib/chevre/service/project.js +0 -2
  224. package/lib/chevre/service/reserve/cancelReservation.d.ts +7 -3
  225. package/lib/chevre/service/reserve/cancelReservation.js +15 -25
  226. package/lib/chevre/service/reserve/checkInReservation.d.ts +4 -2
  227. package/lib/chevre/service/reserve/checkInReservation.js +2 -2
  228. package/lib/chevre/service/reserve/confirmReservation.d.ts +4 -2
  229. package/lib/chevre/service/reserve/confirmReservation.js +10 -36
  230. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -1
  231. package/lib/chevre/service/reserve/useReservation.d.ts +6 -2
  232. package/lib/chevre/service/reserve/useReservation.js +6 -24
  233. package/lib/chevre/service/reserveCOA/cancelReservation.d.ts +4 -2
  234. package/lib/chevre/service/reserveCOA/cancelReservation.js +3 -3
  235. package/lib/chevre/service/scheduledTask.d.ts +1 -4
  236. package/lib/chevre/service/scheduledTask.js +3 -10
  237. package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +1 -2
  238. package/lib/chevre/service/scheduledTaskHandler.js +0 -13
  239. package/lib/chevre/service/task/acceptCOAOffer.js +5 -19
  240. package/lib/chevre/service/task/authorizePayment.js +6 -13
  241. package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
  242. package/lib/chevre/service/task/cancelReservation.js +3 -5
  243. package/lib/chevre/service/task/checkMovieTicket.js +8 -13
  244. package/lib/chevre/service/task/checkResource.js +14 -57
  245. package/lib/chevre/service/task/confirmPayTransaction.js +11 -12
  246. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -2
  247. package/lib/chevre/service/task/confirmReserveTransaction.js +12 -7
  248. package/lib/chevre/service/task/createAccountingReport.js +8 -15
  249. package/lib/chevre/service/task/deleteTransaction.js +10 -41
  250. package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
  251. package/lib/chevre/service/task/invalidatePaymentUrl.js +0 -1
  252. package/lib/chevre/service/task/onAuthorizationCreated.js +4 -13
  253. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +4 -2
  254. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +4 -4
  255. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +4 -2
  256. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +4 -4
  257. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +4 -2
  258. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +4 -4
  259. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +4 -2
  260. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +4 -4
  261. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +4 -2
  262. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +4 -4
  263. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +4 -2
  264. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +4 -4
  265. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +4 -2
  266. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +4 -4
  267. package/lib/chevre/service/task/onResourceDeleted.js +4 -3
  268. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +0 -1
  269. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
  270. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +0 -1
  271. package/lib/chevre/service/task/onResourceUpdated.js +0 -10
  272. package/lib/chevre/service/task/pay.js +3 -3
  273. package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +0 -1
  274. package/lib/chevre/service/task/payment/payByTask.d.ts +3 -2
  275. package/lib/chevre/service/task/payment/payByTask.js +1 -1
  276. package/lib/chevre/service/task/payment/refundByTask.d.ts +0 -1
  277. package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +0 -2
  278. package/lib/chevre/service/task/placeOrder.js +8 -6
  279. package/lib/chevre/service/task/publishPaymentUrl.js +6 -18
  280. package/lib/chevre/service/task/refund.js +0 -1
  281. package/lib/chevre/service/task/reserve.js +3 -6
  282. package/lib/chevre/service/task/returnOrder.js +3 -7
  283. package/lib/chevre/service/task/returnPayTransaction.js +9 -19
  284. package/lib/chevre/service/task/returnReserveTransaction.js +5 -6
  285. package/lib/chevre/service/task/sendEmailMessage.js +2 -2
  286. package/lib/chevre/service/task/sendOrder.js +4 -8
  287. package/lib/chevre/service/task/syncResourcesFromCOA.js +31 -23
  288. package/lib/chevre/service/task/triggerWebhook.js +4 -2
  289. package/lib/chevre/service/task/useReservation.js +6 -2
  290. package/lib/chevre/service/task/voidPayment.js +0 -2
  291. package/lib/chevre/service/task/voidReserveTransaction.js +11 -13
  292. package/lib/chevre/service/task.d.ts +4 -4
  293. package/lib/chevre/service/task.js +8 -12
  294. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +0 -1
  295. package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +3 -2
  296. package/lib/chevre/service/taskHandler/onOperationFailed.js +5 -16
  297. package/lib/chevre/service/taskHandler.d.ts +1 -2
  298. package/lib/chevre/service/taskHandler.js +7 -19
  299. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
  300. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
  301. package/lib/chevre/service/transaction/deleteTransaction.d.ts +8 -4
  302. package/lib/chevre/service/transaction/deleteTransaction.js +7 -7
  303. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
  304. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
  305. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +11 -17
  306. package/lib/chevre/service/transaction/returnOrder.js +11 -17
  307. package/lib/chevre/service/validation/validateOrder.d.ts +0 -4
  308. package/lib/chevre/service/validation/validateOrder.js +3 -3
  309. package/lib/chevre/taskSettings.d.ts +4 -4
  310. package/package.json +2 -2
  311. package/lib/chevre/repo/action/actionProcess.d.ts +0 -147
  312. package/lib/chevre/repo/action/actionProcess.js +0 -775
  313. package/lib/chevre/repo/action/checkThing.d.ts +0 -8
  314. package/lib/chevre/repo/action/checkThing.js +0 -13
  315. package/lib/chevre/repo/action.js +0 -468
  316. package/lib/chevre/repo/asyncActionLegacy.d.ts +0 -23
  317. package/lib/chevre/repo/asyncActionLegacy.js +0 -59
  318. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -227
  319. package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.d.ts +0 -25
  320. package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.js +0 -100
  321. package/lib/chevre/repo/ownershipInfo.d.ts +0 -122
  322. package/lib/chevre/repo/ownershipInfo.js +0 -466
  323. package/lib/chevre/repo/scheduledTaskLegacy.d.ts +0 -39
  324. package/lib/chevre/repo/scheduledTaskLegacy.js +0 -96
  325. package/lib/chevre/repo/scheduledTaskMigration.d.ts +0 -21
  326. package/lib/chevre/repo/scheduledTaskMigration.js +0 -70
  327. package/lib/chevre/service/validation/validateEvent.d.ts +0 -11
  328. package/lib/chevre/service/validation/validateEvent.js +0 -21
@@ -1,6 +1,7 @@
1
1
  import { Surfrock } from '@surfrock/sdk';
2
+ import type { Connection } from 'mongoose';
2
3
  import { factory } from '../../factory';
3
- import { ActionProcessRepo, IActionRecipe } from './actionProcess';
4
+ import { ActionProcessRepo, IActionRecipe } from './anyAction/actionProcess';
4
5
  export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
5
6
  knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
6
7
  };
@@ -60,6 +61,15 @@ export type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTi
60
61
  * 決済カード認証アクションリポジトリ
61
62
  */
62
63
  export declare class CheckMovieTicketActionRepo extends ActionProcessRepo<ICheckMovieTicketAction, IActionRecipe<factory.recipe.RecipeCategory.checkMovieTicket>> {
64
+ constructor(connection: Connection);
65
+ findActionBySameAs(params: {
66
+ sameAs: {
67
+ id: string;
68
+ };
69
+ purpose?: {
70
+ id: string;
71
+ };
72
+ }): Promise<Pick<import("@chevre/factory/lib/chevre/action/check/paymentMethod/movieTicket").IAction, "error" | "id" | "purpose" | "actionStatus"> | null>;
63
73
  /**
64
74
  * アクションIDからレシピのafterMediaを参照する
65
75
  */
@@ -3,11 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CheckMovieTicketActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
5
  const settings_1 = require("../../settings");
6
- const actionProcess_1 = require("./actionProcess");
6
+ const actionProcess_1 = require("./anyAction/actionProcess");
7
+ const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
7
8
  /**
8
9
  * 決済カード認証アクションリポジトリ
9
10
  */
10
11
  class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
12
+ constructor(connection) {
13
+ super({ connection }, {
14
+ expireAfterSeconds: EXPIRE_AFTER_SECONDS,
15
+ recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
16
+ });
17
+ }
18
+ async findActionBySameAs(params) {
19
+ return this.actionModel.findOne({
20
+ typeOf: { $eq: factory_1.factory.actionType.CheckAction }, // 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
21
+ 'sameAs.id': { $exists: true, $eq: params.sameAs.id },
22
+ ...(typeof params.purpose?.id === 'string')
23
+ ? { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
24
+ : undefined
25
+ }, {
26
+ _id: 0,
27
+ id: { $toString: '$_id' },
28
+ actionStatus: 1,
29
+ error: 1,
30
+ purpose: 1
31
+ })
32
+ .lean()
33
+ .exec();
34
+ }
11
35
  /**
12
36
  * アクションIDからレシピのafterMediaを参照する
13
37
  */
@@ -0,0 +1,11 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
4
+ export type IConfirmAction = factory.action.interact.confirm.pay.IAction | factory.action.interact.confirm.reservation.IAction;
5
+ export type IActionRecipe = factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe;
6
+ /**
7
+ * 資産取引確定アクションリポジトリ
8
+ */
9
+ export declare class ConfirmActionRepo extends ActionProcessRepo<IConfirmAction, IActionRecipe> {
10
+ constructor(connection: Connection);
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfirmActionRepo = void 0;
4
+ const actionProcess_1 = require("./anyAction/actionProcess");
5
+ /**
6
+ * 資産取引確定アクションリポジトリ
7
+ */
8
+ class ConfirmActionRepo extends actionProcess_1.ActionProcessRepo {
9
+ constructor(connection) {
10
+ super({ connection }, {
11
+ expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
12
+ recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
13
+ });
14
+ }
15
+ }
16
+ exports.ConfirmActionRepo = ConfirmActionRepo;
@@ -0,0 +1,10 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
4
+ export type ICreateAction = factory.action.create.IAction;
5
+ /**
6
+ * レポート作成アクションリポジトリ
7
+ */
8
+ export declare class CreateActionRepo extends ActionProcessRepo<ICreateAction, never> {
9
+ constructor(connection: Connection);
10
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateActionRepo = void 0;
4
+ const actionProcess_1 = require("./anyAction/actionProcess");
5
+ const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
6
+ /**
7
+ * レポート作成アクションリポジトリ
8
+ */
9
+ class CreateActionRepo extends actionProcess_1.ActionProcessRepo {
10
+ constructor(connection) {
11
+ super({ connection }, {
12
+ expireAfterSeconds: EXPIRE_AFTER_SECONDS,
13
+ recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
14
+ });
15
+ }
16
+ }
17
+ exports.CreateActionRepo = CreateActionRepo;
@@ -0,0 +1,46 @@
1
+ import { Connection } from 'mongoose';
2
+ import { factory } from '../../../factory';
3
+ import type { IAbstractActionModel } from '../../mongoose/schemas/action/abstractAction';
4
+ import { ActionRecipeRepo, IActionRecipe, IRecipeAsActionAttributes } from '../anyAction/actionRecipe';
5
+ type AvailableActionType = factory.actionType.InformAction | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction | factory.actionType.UseAction;
6
+ type IAction<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IAction : never;
7
+ type IActionAttributes<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IAttributes : T extends factory.actionType.AddAction ? factory.action.update.add.IAttributes : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAttributes : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAttributes : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAttributes : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IAttributes : never;
8
+ type IResult<T extends AvailableActionType> = T extends factory.actionType.InformAction ? factory.action.interact.inform.IResult : T extends factory.actionType.AddAction ? factory.action.update.add.IResult : T extends factory.actionType.UpdateAction ? factory.action.update.update.IResult : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IResult : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IResult : T extends factory.actionType.UseAction ? factory.action.consume.use.reservation.IResult : never;
9
+ interface IOptions {
10
+ expireAfterSeconds: number;
11
+ recipeExpireAfterSeconds: number;
12
+ }
13
+ /**
14
+ * 専用アクション状態管理リポジトリ
15
+ * mongoose modelは継承クラスから指定される前提
16
+ */
17
+ export declare class DedicatedActionProcessRepo<TActionType extends AvailableActionType, TActionRecipe extends IActionRecipe<factory.recipe.RecipeCategory>> extends ActionRecipeRepo<TActionRecipe> {
18
+ private readonly actionModel;
19
+ private options;
20
+ protected constructor(params: {
21
+ connection: Connection;
22
+ actionModel: IAbstractActionModel;
23
+ }, options: IOptions);
24
+ /**
25
+ * アクション開始
26
+ */
27
+ protected startAction<T extends TActionType>(attributes: IActionAttributes<T>, options?: {
28
+ recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
29
+ }): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>>;
30
+ protected completeAction<T extends TActionType>(params: {
31
+ typeOf: T;
32
+ id: string;
33
+ result?: IResult<T>;
34
+ recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
35
+ }): Promise<void>;
36
+ /**
37
+ * アクション失敗
38
+ */
39
+ protected giveUpAction<T extends TActionType>(params: {
40
+ typeOf: T;
41
+ id: string;
42
+ error: Error | Error[] | unknown;
43
+ recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
44
+ }): Promise<void>;
45
+ }
46
+ export {};
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DedicatedActionProcessRepo = void 0;
4
+ const factory_1 = require("../../../factory");
5
+ const unknown2actionError_1 = require("../unknown2actionError");
6
+ const actionRecipe_1 = require("../anyAction/actionRecipe");
7
+ /**
8
+ * 専用アクション状態管理リポジトリ
9
+ * mongoose modelは継承クラスから指定される前提
10
+ */
11
+ class DedicatedActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
12
+ actionModel;
13
+ options;
14
+ constructor(params, options) {
15
+ super(params, options);
16
+ this.actionModel = params.actionModel;
17
+ this.options = options;
18
+ }
19
+ /**
20
+ * アクション開始
21
+ */
22
+ async startAction(attributes, options) {
23
+ const startDate = new Date();
24
+ const expires = new Date(startDate.getTime() + this.options.expireAfterSeconds * 1000);
25
+ const creatingAction = {
26
+ ...attributes,
27
+ actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
28
+ startDate,
29
+ expires
30
+ };
31
+ const result = await this.actionModel.insertMany(creatingAction, { rawResult: true });
32
+ const id = result.insertedIds?.[0]?.toHexString();
33
+ if (typeof id !== 'string') {
34
+ throw new factory_1.factory.errors.Internal('action not saved');
35
+ }
36
+ // add recipe
37
+ const savingRecipe = options?.recipe;
38
+ if (savingRecipe?.typeOf === 'Recipe') {
39
+ await this.upsertRecipe({ ...savingRecipe, recipeFor: { id, typeOf: creatingAction.typeOf } });
40
+ }
41
+ return { id, startDate, typeOf: creatingAction.typeOf };
42
+ }
43
+ async completeAction(params) {
44
+ const endDate = new Date();
45
+ if (params.recipe?.typeOf === 'Recipe') {
46
+ await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
47
+ }
48
+ const doc = await this.actionModel.findOneAndUpdate({
49
+ _id: { $eq: params.id },
50
+ actionStatus: { $eq: factory_1.factory.actionStatusType.ActiveActionStatus }
51
+ }, {
52
+ $set: {
53
+ actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
54
+ endDate,
55
+ ...((params.result !== undefined) && { result: params.result })
56
+ }
57
+ }, { new: false, projection: { _id: 1 } })
58
+ .lean()
59
+ .exec();
60
+ if (doc === null) {
61
+ throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
62
+ }
63
+ }
64
+ /**
65
+ * アクション失敗
66
+ */
67
+ async giveUpAction(params) {
68
+ const endDate = new Date();
69
+ const actionError = Array.isArray(params.error)
70
+ ? params.error.map(unknown2actionError_1.unknown2actionError)
71
+ : (0, unknown2actionError_1.unknown2actionError)(params.error);
72
+ if (params.recipe?.typeOf === 'Recipe') {
73
+ await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
74
+ }
75
+ const doc = await this.actionModel.findOneAndUpdate({
76
+ _id: { $eq: params.id },
77
+ actionStatus: { $eq: factory_1.factory.actionStatusType.ActiveActionStatus }
78
+ }, {
79
+ $set: {
80
+ actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
81
+ error: actionError,
82
+ endDate
83
+ }
84
+ }, { new: false, projection: { _id: 1 } })
85
+ .lean()
86
+ .exec();
87
+ if (doc === null) {
88
+ throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
89
+ }
90
+ }
91
+ }
92
+ exports.DedicatedActionProcessRepo = DedicatedActionProcessRepo;
@@ -0,0 +1,39 @@
1
+ import { Connection, FilterQuery } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { IDocType } from '../mongoose/schemas/action/inform';
4
+ import { DedicatedActionProcessRepo } from './dedicatedAction/dedicatedActionProcess';
5
+ type StartableActionType = factory.actionType.InformAction;
6
+ type IAction = IDocType & {
7
+ id: string;
8
+ };
9
+ type IKeyOfProjection = keyof IDocType;
10
+ type IFindParams = Pick<factory.action.ISearchConditions, 'limit' | 'page' | 'project' | 'sort' | 'startFrom' | 'startThrough'> & {
11
+ id?: string;
12
+ };
13
+ /**
14
+ * 通知アクションリポジトリ
15
+ */
16
+ export declare class InformActionRepo extends DedicatedActionProcessRepo<StartableActionType, never> {
17
+ private readonly informActionModel;
18
+ constructor(connection: Connection);
19
+ static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<IDocType>[];
20
+ /**
21
+ * アクション開始
22
+ */
23
+ startInformAction(attributes: factory.action.interact.inform.IAttributes): Promise<Pick<IAction, 'id' | 'typeOf' | 'startDate'>>;
24
+ completeInformAction(params: {
25
+ typeOf: StartableActionType;
26
+ id: string;
27
+ result: factory.action.interact.inform.IResult;
28
+ }): Promise<void>;
29
+ /**
30
+ * アクション失敗
31
+ */
32
+ giveUpInformAction(params: {
33
+ typeOf: StartableActionType;
34
+ id: string;
35
+ error: Error | Error[] | unknown;
36
+ }): Promise<void>;
37
+ findInformActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction[]>;
38
+ }
39
+ export {};
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InformActionRepo = void 0;
4
+ const settings_1 = require("../../settings");
5
+ const inform_1 = require("../mongoose/schemas/action/inform");
6
+ const dedicatedActionProcess_1 = require("./dedicatedAction/dedicatedActionProcess");
7
+ const AVAILABLE_PROJECT_FIELDS = [
8
+ 'project',
9
+ 'actionStatus',
10
+ 'typeOf',
11
+ 'agent',
12
+ 'result',
13
+ 'error',
14
+ 'object',
15
+ 'startDate',
16
+ 'endDate',
17
+ 'about',
18
+ 'purpose',
19
+ 'recipient',
20
+ 'target',
21
+ 'expires'
22
+ ];
23
+ const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
24
+ /**
25
+ * 通知アクションリポジトリ
26
+ */
27
+ class InformActionRepo extends dedicatedActionProcess_1.DedicatedActionProcessRepo {
28
+ informActionModel;
29
+ constructor(connection) {
30
+ const informActionModel = connection.model(inform_1.modelName, (0, inform_1.createSchema)());
31
+ super({
32
+ connection,
33
+ actionModel: informActionModel
34
+ }, {
35
+ expireAfterSeconds: EXPIRE_AFTER_SECONDS,
36
+ recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
37
+ });
38
+ this.informActionModel = informActionModel;
39
+ }
40
+ static CREATE_MONGO_CONDITIONS(params) {
41
+ const andConditions = [];
42
+ const idEq = params.id;
43
+ if (typeof idEq === 'string') {
44
+ andConditions.push({ _id: { $eq: idEq } });
45
+ }
46
+ const projectIdEq = params.project?.id?.$eq;
47
+ if (typeof projectIdEq === 'string') {
48
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
49
+ }
50
+ // const objectIdEq = params.object?.id;
51
+ // if (typeof objectIdEq === 'string') {
52
+ // andConditions.push({ 'object.id': { $exists: true, $eq: objectIdEq } });
53
+ // }
54
+ // const objectOrderNumberEq = params.object?.orderNumber;
55
+ // if (typeof objectOrderNumberEq === 'string') {
56
+ // andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
57
+ // }
58
+ // const aboutOrderNumberEq = params.about?.orderNumber;
59
+ // if (typeof aboutOrderNumberEq === 'string') {
60
+ // andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
61
+ // }
62
+ const startDateGte = params.startFrom;
63
+ if (startDateGte instanceof Date) {
64
+ andConditions.push({ startDate: { $gte: startDateGte } });
65
+ }
66
+ const startDateLte = params.startThrough;
67
+ if (startDateLte instanceof Date) {
68
+ andConditions.push({ startDate: { $lte: startDateLte } });
69
+ }
70
+ return andConditions;
71
+ }
72
+ /**
73
+ * アクション開始
74
+ */
75
+ async startInformAction(attributes) {
76
+ return this.startAction(attributes);
77
+ }
78
+ async completeInformAction(params) {
79
+ await this.completeAction(params);
80
+ }
81
+ /**
82
+ * アクション失敗
83
+ */
84
+ async giveUpInformAction(params) {
85
+ await this.giveUpAction(params);
86
+ }
87
+ async findInformActions(params, inclusion) {
88
+ const conditions = InformActionRepo.CREATE_MONGO_CONDITIONS(params);
89
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
90
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
91
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
92
+ }
93
+ const projection = {
94
+ _id: 0,
95
+ id: { $toString: '$_id' },
96
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
97
+ };
98
+ const query = this.informActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
99
+ if (typeof params.limit === 'number' && params.limit > 0) {
100
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
101
+ query.limit(params.limit)
102
+ .skip(params.limit * (page - 1));
103
+ }
104
+ /* istanbul ignore else */
105
+ if (params.sort?.startDate !== undefined) {
106
+ query.sort({ startDate: params.sort.startDate });
107
+ }
108
+ // const explainResult = await (<any>query).explain();
109
+ // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
110
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
111
+ .lean() // 2024-08-26~
112
+ .exec();
113
+ }
114
+ }
115
+ exports.InformActionRepo = InformActionRepo;
@@ -0,0 +1,21 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
4
+ export type IOrderAction = factory.action.trade.order.IAction;
5
+ /**
6
+ * 注文アクションリポジトリ
7
+ */
8
+ export declare class OrderActionRepo extends ActionProcessRepo<IOrderAction, never> {
9
+ constructor(connection: Connection);
10
+ /**
11
+ * 完了済予約アクション検索
12
+ */
13
+ findCompletedOrderAction(params: {
14
+ object: {
15
+ orderNumber: string;
16
+ };
17
+ purpose: {
18
+ id: string;
19
+ };
20
+ }): Promise<Pick<IOrderAction, 'id'> | null>;
21
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderActionRepo = void 0;
4
+ const factory_1 = require("../../factory");
5
+ const actionProcess_1 = require("./anyAction/actionProcess");
6
+ const settings_1 = require("../../settings");
7
+ /**
8
+ * 注文アクションリポジトリ
9
+ */
10
+ class OrderActionRepo extends actionProcess_1.ActionProcessRepo {
11
+ constructor(connection) {
12
+ super({ connection }, {
13
+ expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
14
+ recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
15
+ });
16
+ }
17
+ /**
18
+ * 完了済予約アクション検索
19
+ */
20
+ async findCompletedOrderAction(params) {
21
+ const query = this.actionModel.findOne({
22
+ actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus },
23
+ typeOf: { $eq: factory_1.factory.actionType.OrderAction },
24
+ 'object.orderNumber': { $exists: true, $eq: params.object.orderNumber },
25
+ 'purpose.id': { $exists: true, $eq: params.purpose.id }
26
+ }, {
27
+ _id: 0,
28
+ id: { $toString: '$_id' }
29
+ });
30
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
31
+ .lean()
32
+ .exec();
33
+ }
34
+ }
35
+ exports.OrderActionRepo = OrderActionRepo;
@@ -1,11 +1,13 @@
1
+ import type { Connection } from 'mongoose';
1
2
  import { factory } from '../../factory';
2
- import { ActionProcessRepo } from './actionProcess';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
3
4
  export type IPayAction = factory.action.trade.pay.IAction;
4
5
  export type IActionRecipe = factory.action.trade.pay.IPayCreditCardRecipe | factory.action.trade.pay.IPayMovieTicketRecipe;
5
6
  /**
6
7
  * 決済アクションリポジトリ
7
8
  */
8
9
  export declare class PayActionRepo extends ActionProcessRepo<IPayAction, IActionRecipe> {
10
+ constructor(connection: Connection);
9
11
  /**
10
12
  * 決済方法IDから決済アクションをひとつ参照する
11
13
  * デフォルトでCompletedActionStatusのみ参照
@@ -2,20 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PayActionRepo = void 0;
4
4
  const factory_1 = require("../../factory");
5
- // import { MONGO_MAX_TIME_MS } from '../settings';
6
- // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
7
- // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
8
- const actionProcess_1 = require("./actionProcess");
5
+ const actionProcess_1 = require("./anyAction/actionProcess");
9
6
  /**
10
7
  * 決済アクションリポジトリ
11
8
  */
12
9
  class PayActionRepo extends actionProcess_1.ActionProcessRepo {
10
+ constructor(connection) {
11
+ super({ connection }, {
12
+ expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
13
+ recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
14
+ });
15
+ }
13
16
  /**
14
17
  * 決済方法IDから決済アクションをひとつ参照する
15
18
  * デフォルトでCompletedActionStatusのみ参照
16
19
  */
17
20
  async findPayActionByPaymentMethodId(params) {
18
- const payActions = await this.findAnyActions({
21
+ const payActions = await this.findAnyActionsLegacy({
19
22
  limit: 1,
20
23
  page: 1,
21
24
  actionStatus: (Array.isArray(params.actionStatus?.$in))
@@ -1,9 +1,11 @@
1
+ import type { Connection } from 'mongoose';
1
2
  import { factory } from '../../factory';
2
- import { ActionProcessRepo } from './actionProcess';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
3
4
  export type IRefundAction = factory.action.trade.refund.IAction;
4
5
  export type IActionRecipe = factory.action.trade.refund.IRefundCreditCardRecipe | factory.action.trade.refund.IRefundMovieTicketRecipe;
5
6
  /**
6
7
  * 返金アクションリポジトリ
7
8
  */
8
9
  export declare class RefundActionRepo extends ActionProcessRepo<IRefundAction, IActionRecipe> {
10
+ constructor(connection: Connection);
9
11
  }
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RefundActionRepo = 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");
4
+ const actionProcess_1 = require("./anyAction/actionProcess");
8
5
  /**
9
6
  * 返金アクションリポジトリ
10
7
  */
11
8
  class RefundActionRepo extends actionProcess_1.ActionProcessRepo {
9
+ constructor(connection) {
10
+ super({ connection }, {
11
+ expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
12
+ recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
13
+ });
14
+ }
12
15
  }
13
16
  exports.RefundActionRepo = RefundActionRepo;
@@ -0,0 +1,21 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
4
+ export type IReserveAction = factory.action.reserve.IAction;
5
+ /**
6
+ * 予約アクションリポジトリ
7
+ */
8
+ export declare class ReserveActionRepo extends ActionProcessRepo<IReserveAction, never> {
9
+ constructor(connection: Connection);
10
+ /**
11
+ * 完了済予約アクション検索
12
+ */
13
+ findCompletedReserveAction(params: {
14
+ purpose: {
15
+ /**
16
+ * 予約取引ID
17
+ */
18
+ id: string;
19
+ };
20
+ }): Promise<Pick<IReserveAction, 'id'> | null>;
21
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReserveActionRepo = void 0;
4
+ const factory_1 = require("../../factory");
5
+ const actionProcess_1 = require("./anyAction/actionProcess");
6
+ const settings_1 = require("../../settings");
7
+ /**
8
+ * 予約アクションリポジトリ
9
+ */
10
+ class ReserveActionRepo extends actionProcess_1.ActionProcessRepo {
11
+ constructor(connection) {
12
+ super({ connection }, {
13
+ expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
14
+ recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
15
+ });
16
+ }
17
+ /**
18
+ * 完了済予約アクション検索
19
+ */
20
+ async findCompletedReserveAction(params) {
21
+ const query = this.actionModel.findOne({
22
+ actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus },
23
+ typeOf: { $eq: factory_1.factory.actionType.ReserveAction },
24
+ // object: {
25
+ // typeOf: { $eq: actionAttributes.object.typeOf }
26
+ // },
27
+ 'purpose.id': { $exists: true, $eq: params.purpose.id }
28
+ }, {
29
+ _id: 0,
30
+ id: { $toString: '$_id' }
31
+ });
32
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
33
+ .lean()
34
+ .exec();
35
+ }
36
+ }
37
+ exports.ReserveActionRepo = ReserveActionRepo;
@@ -0,0 +1,11 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { ActionProcessRepo } from './anyAction/actionProcess';
4
+ export type IReturnAction = factory.action.transfer.returnAction.invoice.IAction | factory.action.transfer.returnAction.order.IAction | factory.action.transfer.returnAction.reserveTransaction.IAction;
5
+ export type IActionRecipe = factory.action.transfer.returnAction.reserveTransaction.IReturnCOAReserveRecipe;
6
+ /**
7
+ * 返品(返却)アクションリポジトリ
8
+ */
9
+ export declare class ReturnActionRepo extends ActionProcessRepo<IReturnAction, IActionRecipe> {
10
+ constructor(connection: Connection);
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReturnActionRepo = void 0;
4
+ const actionProcess_1 = require("./anyAction/actionProcess");
5
+ /**
6
+ * 返品(返却)アクションリポジトリ
7
+ */
8
+ class ReturnActionRepo extends actionProcess_1.ActionProcessRepo {
9
+ constructor(connection) {
10
+ super({ connection }, {
11
+ expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
12
+ recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
13
+ });
14
+ }
15
+ }
16
+ exports.ReturnActionRepo = ReturnActionRepo;
@@ -0,0 +1,10 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { factory } from '../../factory';
3
+ import { ActionProcessRepo, IActionRecipe } from './anyAction/actionProcess';
4
+ export type ISendAction = factory.action.transfer.send.message.email.IAction;
5
+ /**
6
+ * メッセージ送信アクションリポジトリ
7
+ */
8
+ export declare class SendEmailMessageActionRepo extends ActionProcessRepo<ISendAction, IActionRecipe<factory.recipe.RecipeCategory.sendEmailMessage>> {
9
+ constructor(connection: Connection);
10
+ }