@chevre/domain 21.2.0-alpha.1 → 21.2.0-alpha.100

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 (306) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
  3. package/example/src/chevre/countDelayedTasks.ts +17 -0
  4. package/example/src/chevre/countDelayedTransactions.ts +60 -0
  5. package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
  6. package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
  7. package/example/src/chevre/deleteTasksByName.ts +10 -2
  8. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  9. package/example/src/chevre/lockStockHolder.ts +48 -0
  10. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  11. package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
  12. package/example/src/chevre/processPay.ts +5 -1
  13. package/example/src/chevre/processReserve.ts +6 -3
  14. package/example/src/chevre/saveTasks.ts +13 -10
  15. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  16. package/example/src/chevre/searchActions.ts +33 -0
  17. package/example/src/chevre/searchEventSeats.ts +42 -0
  18. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  19. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  20. package/example/src/chevre/task/executeTasks.ts +26 -0
  21. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  22. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  23. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  24. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  25. package/example/src/chevre/updateTransaction.ts +1 -1
  26. package/example/src/playOnMoment.ts +24 -0
  27. package/lib/chevre/credentials.d.ts +1 -0
  28. package/lib/chevre/credentials.js +2 -1
  29. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  30. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  31. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  32. package/lib/chevre/eventEmitter/task.js +25 -0
  33. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  34. package/lib/chevre/eventEmitter/transaction.js +25 -0
  35. package/lib/chevre/eventEmitter.d.ts +4 -0
  36. package/lib/chevre/eventEmitter.js +9 -0
  37. package/lib/chevre/index.d.ts +3 -2
  38. package/lib/chevre/index.js +5 -3
  39. package/lib/chevre/repo/account.js +0 -4
  40. package/lib/chevre/repo/accountTitle.js +0 -4
  41. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  42. package/lib/chevre/repo/accountTransaction.js +1 -58
  43. package/lib/chevre/repo/accountingReport.js +0 -4
  44. package/lib/chevre/repo/action.d.ts +29 -1
  45. package/lib/chevre/repo/action.js +98 -59
  46. package/lib/chevre/repo/additionalProperty.js +0 -4
  47. package/lib/chevre/repo/aggregation.js +0 -4
  48. package/lib/chevre/repo/assetTransaction.d.ts +25 -9
  49. package/lib/chevre/repo/assetTransaction.js +261 -89
  50. package/lib/chevre/repo/categoryCode.js +0 -4
  51. package/lib/chevre/repo/code.js +0 -4
  52. package/lib/chevre/repo/comment.d.ts +4 -1
  53. package/lib/chevre/repo/comment.js +20 -9
  54. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  55. package/lib/chevre/repo/confirmationNumber.js +3 -15
  56. package/lib/chevre/repo/creativeWork.d.ts +1 -3
  57. package/lib/chevre/repo/creativeWork.js +0 -4
  58. package/lib/chevre/repo/customer.js +0 -4
  59. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  60. package/lib/chevre/repo/emailMessage.js +0 -4
  61. package/lib/chevre/repo/event.d.ts +5 -1
  62. package/lib/chevre/repo/event.js +0 -4
  63. package/lib/chevre/repo/member.js +0 -4
  64. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  65. package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
  66. package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
  67. package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
  68. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
  69. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
  70. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
  72. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
  73. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
  74. package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
  75. package/lib/chevre/repo/mongoose/schemas/action.js +20 -1
  76. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
  77. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
  78. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
  79. package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
  80. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
  81. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +33 -19
  82. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
  83. package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
  84. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
  85. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
  86. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
  87. package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
  88. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
  89. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
  90. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
  91. package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
  92. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
  93. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
  94. package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
  95. package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
  96. package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
  97. package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
  98. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
  99. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
  100. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
  101. package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
  102. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
  103. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
  104. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  105. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  106. package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
  107. package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
  108. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
  109. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
  110. package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
  111. package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
  112. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
  113. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
  114. package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
  115. package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
  116. package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
  117. package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
  118. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +64 -5
  119. package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
  120. package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
  121. package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
  122. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
  123. package/lib/chevre/repo/mongoose/schemas/seller.js +7 -0
  124. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
  125. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
  126. package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
  127. package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
  128. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
  129. package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
  130. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
  131. package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
  132. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
  133. package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
  134. package/lib/chevre/repo/offer.js +0 -5
  135. package/lib/chevre/repo/offerCatalog.js +0 -4
  136. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  137. package/lib/chevre/repo/offerItemCondition.js +120 -0
  138. package/lib/chevre/repo/order.d.ts +55 -3
  139. package/lib/chevre/repo/order.js +56 -9
  140. package/lib/chevre/repo/orderNumber.d.ts +0 -1
  141. package/lib/chevre/repo/orderNumber.js +2 -12
  142. package/lib/chevre/repo/ownershipInfo.js +0 -4
  143. package/lib/chevre/repo/permit.js +0 -4
  144. package/lib/chevre/repo/place.d.ts +5 -1
  145. package/lib/chevre/repo/place.js +1 -10
  146. package/lib/chevre/repo/priceSpecification.js +0 -4
  147. package/lib/chevre/repo/product.js +0 -4
  148. package/lib/chevre/repo/project.js +0 -4
  149. package/lib/chevre/repo/rateLimit/offer.d.ts +3 -2
  150. package/lib/chevre/repo/rateLimit/offer.js +14 -14
  151. package/lib/chevre/repo/reservation.d.ts +12 -4
  152. package/lib/chevre/repo/reservation.js +16 -48
  153. package/lib/chevre/repo/role.js +0 -4
  154. package/lib/chevre/repo/seller.js +19 -23
  155. package/lib/chevre/repo/serviceOutput.js +0 -4
  156. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +2 -1
  157. package/lib/chevre/repo/serviceOutputIdentifier.js +14 -15
  158. package/lib/chevre/repo/{itemAvailability/screeningEvent.d.ts → stockHolder.d.ts} +5 -8
  159. package/lib/chevre/repo/stockHolder.js +273 -0
  160. package/lib/chevre/repo/task.d.ts +45 -2
  161. package/lib/chevre/repo/task.js +101 -12
  162. package/lib/chevre/repo/telemetry.js +0 -4
  163. package/lib/chevre/repo/transaction.d.ts +23 -3
  164. package/lib/chevre/repo/transaction.js +174 -58
  165. package/lib/chevre/repo/transactionNumber.d.ts +2 -1
  166. package/lib/chevre/repo/transactionNumber.js +14 -15
  167. package/lib/chevre/repo/trip.js +0 -4
  168. package/lib/chevre/repository.d.ts +8 -7
  169. package/lib/chevre/repository.js +12 -11
  170. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
  171. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +4 -3
  172. package/lib/chevre/service/aggregation/system.d.ts +67 -22
  173. package/lib/chevre/service/aggregation/system.js +101 -89
  174. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  175. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
  176. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  177. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  178. package/lib/chevre/service/assetTransaction/pay.js +18 -32
  179. package/lib/chevre/service/assetTransaction/refund.js +1 -23
  180. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  181. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  182. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  183. package/lib/chevre/service/assetTransaction/reserve.d.ts +14 -5
  184. package/lib/chevre/service/assetTransaction/reserve.js +156 -74
  185. package/lib/chevre/service/assetTransaction.d.ts +6 -2
  186. package/lib/chevre/service/assetTransaction.js +9 -5
  187. package/lib/chevre/service/event.js +3 -1
  188. package/lib/chevre/service/notification/factory.js +2 -2
  189. package/lib/chevre/service/notification.d.ts +3 -1
  190. package/lib/chevre/service/notification.js +41 -7
  191. package/lib/chevre/service/offer/event/authorize.d.ts +5 -2
  192. package/lib/chevre/service/offer/event/authorize.js +8 -2
  193. package/lib/chevre/service/offer/event/cancel.d.ts +2 -2
  194. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  195. package/lib/chevre/service/offer/event/factory.js +16 -5
  196. package/lib/chevre/service/offer/event/voidTransaction.d.ts +4 -2
  197. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  198. package/lib/chevre/service/offer.d.ts +13 -26
  199. package/lib/chevre/service/offer.js +22 -117
  200. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  201. package/lib/chevre/service/order/deleteOrder.js +8 -8
  202. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  203. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  204. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  205. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  206. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  207. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  208. package/lib/chevre/service/order/placeOrder.js +41 -24
  209. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  210. package/lib/chevre/service/order/returnOrder.js +7 -12
  211. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  212. package/lib/chevre/service/order/sendOrder.js +7 -10
  213. package/lib/chevre/service/order.d.ts +2 -1
  214. package/lib/chevre/service/order.js +3 -1
  215. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  216. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  217. package/lib/chevre/service/payment/any.d.ts +9 -5
  218. package/lib/chevre/service/payment/any.js +80 -18
  219. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  220. package/lib/chevre/service/payment/creditCard.js +21 -15
  221. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +7 -6
  222. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  223. package/lib/chevre/service/payment/movieTicket/validation.js +54 -31
  224. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  225. package/lib/chevre/service/payment/movieTicket.js +5 -4
  226. package/lib/chevre/service/product.js +1 -5
  227. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  228. package/lib/chevre/service/report/telemetry.js +21 -24
  229. package/lib/chevre/service/reserve/cancelReservation.d.ts +8 -6
  230. package/lib/chevre/service/reserve/cancelReservation.js +153 -145
  231. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  232. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  233. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  234. package/lib/chevre/service/reserve/confirmReservation.js +125 -58
  235. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  236. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  237. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  238. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  239. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  240. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  241. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  242. package/lib/chevre/service/reserve/useReservation.js +61 -71
  243. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  244. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  245. package/lib/chevre/service/reserve.d.ts +3 -2
  246. package/lib/chevre/service/reserve.js +4 -2
  247. package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -2
  248. package/lib/chevre/service/task/cancelPendingReservation.js +8 -4
  249. package/lib/chevre/service/task/cancelReservation.js +3 -3
  250. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  251. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  252. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  253. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  254. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  255. package/lib/chevre/service/task/placeOrder.js +1 -1
  256. package/lib/chevre/service/task/reserve.js +10 -7
  257. package/lib/chevre/service/task/returnOrder.js +1 -1
  258. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  259. package/lib/chevre/service/task/sendOrder.js +1 -1
  260. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  261. package/lib/chevre/service/task/useReservation.js +36 -0
  262. package/lib/chevre/service/task/voidReserveTransaction.js +6 -4
  263. package/lib/chevre/service/task.d.ts +9 -0
  264. package/lib/chevre/service/task.js +43 -4
  265. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  266. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  267. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  268. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  269. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  270. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  271. package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
  272. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -2
  273. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  274. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  275. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  276. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  277. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  278. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  279. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  280. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  281. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  282. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  283. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  284. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  285. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  286. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  287. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  288. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  289. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  290. package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
  291. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  292. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  293. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  294. package/lib/chevre/service/transaction/returnOrder.js +225 -35
  295. package/lib/chevre/service/transaction.d.ts +8 -13
  296. package/lib/chevre/service/transaction.js +12 -145
  297. package/lib/chevre/settings.d.ts +4 -1
  298. package/lib/chevre/settings.js +16 -6
  299. package/package.json +5 -5
  300. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  301. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  302. package/lib/chevre/repo/itemAvailability/screeningEvent.js +0 -181
  303. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  304. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  305. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
  306. package/lib/chevre/service/task/deleteOrder.js +0 -35
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const moment = require("moment");
14
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
14
  const accountTransaction_1 = require("./mongoose/schemas/accountTransaction");
16
15
  const factory = require("../factory");
17
16
  /**
@@ -20,9 +19,6 @@ const factory = require("../factory");
20
19
  class MongoRepository {
21
20
  constructor(connection) {
22
21
  this.transactionModel = connection.model(accountTransaction_1.modelName, accountTransaction_1.schema);
23
- if (connection.get('autoIndex') === true) {
24
- this.transactionModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
25
- }
26
22
  }
27
23
  static CREATE_MONGO_CONDITIONS(params) {
28
24
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
@@ -225,59 +221,6 @@ class MongoRepository {
225
221
  return doc.toObject();
226
222
  });
227
223
  }
228
- /**
229
- * タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
230
- */
231
- // public async startExportTasks<T extends factory.account.transactionType>(
232
- // status: factory.transactionStatusType
233
- // ): Promise<factory.account.transaction.ITransaction<T> | null> {
234
- // return this.transactionModel.findOneAndUpdate(
235
- // {
236
- // status: status,
237
- // tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
238
- // },
239
- // { tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting },
240
- // { new: true }
241
- // )
242
- // .exec()
243
- // // tslint:disable-next-line:no-null-keyword
244
- // .then((doc) => (doc === null) ? null : doc.toObject());
245
- // }
246
- // tslint:disable-next-line:no-suspicious-comment
247
- /**
248
- * タスクエクスポートリトライ
249
- * TODO updatedAtを基準にしているが、タスクエクスポートトライ日時を持たせた方が安全か?
250
- */
251
- // public async reexportTasks(params: { intervalInMinutes: number }): Promise<void> {
252
- // await this.transactionModel.updateMany(
253
- // {
254
- // tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting,
255
- // updatedAt: {
256
- // $lt: moment()
257
- // .add(-params.intervalInMinutes, 'minutes')
258
- // .toDate()
259
- // }
260
- // },
261
- // {
262
- // tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
263
- // }
264
- // )
265
- // .exec();
266
- // }
267
- /**
268
- * タスクをエクスポート済に変更する
269
- */
270
- // public async setTasksExportedById(transactionId: string): Promise<void> {
271
- // await this.transactionModel.findByIdAndUpdate(
272
- // transactionId,
273
- // {
274
- // tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
275
- // tasksExportedAt: moment()
276
- // .toDate()
277
- // }
278
- // )
279
- // .exec();
280
- // }
281
224
  /**
282
225
  * 取引を期限切れにする
283
226
  */
@@ -286,7 +229,7 @@ class MongoRepository {
286
229
  // ステータスと期限を見て更新
287
230
  yield this.transactionModel.updateMany({
288
231
  status: factory.transactionStatusType.InProgress,
289
- expires: { $lt: params.expires }
232
+ expires: { $lt: params.expires.$lt }
290
233
  }, {
291
234
  status: factory.transactionStatusType.Expired,
292
235
  endDate: new Date()
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
13
  const accountingReport_1 = require("./mongoose/schemas/accountingReport");
15
14
  const errorHandler_1 = require("../errorHandler");
16
15
  /**
@@ -19,9 +18,6 @@ const errorHandler_1 = require("../errorHandler");
19
18
  class MongoRepository {
20
19
  constructor(connection) {
21
20
  this.accountingReportModel = connection.model(accountingReport_1.modelName, accountingReport_1.schema);
22
- if (connection.get('autoIndex') === true) {
23
- this.accountingReportModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
- }
25
21
  }
26
22
  /**
27
23
  * なければ作成する
@@ -82,7 +82,18 @@ export declare class MongoRepository {
82
82
  typeOf?: T;
83
83
  purpose: {
84
84
  typeOf: factory.transactionType;
85
- id?: string;
85
+ id: string;
86
+ };
87
+ object?: {
88
+ typeOf?: {
89
+ $eq?: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment;
90
+ };
91
+ paymentMethodId?: {
92
+ $eq?: string;
93
+ };
94
+ };
95
+ actionStatus?: {
96
+ $eq?: factory.actionStatusType;
86
97
  };
87
98
  sort?: factory.action.ISortOrder;
88
99
  }): Promise<IAction<T>[]>;
@@ -122,6 +133,23 @@ export declare class MongoRepository {
122
133
  deleteEndDatePassedCertainPeriod(params: {
123
134
  $lt: Date;
124
135
  }): Promise<void>;
136
+ /**
137
+ * 取引からアクションを削除する
138
+ */
139
+ deleteByPurpose(params: {
140
+ project: {
141
+ id: string;
142
+ };
143
+ purpose: {
144
+ typeOf: factory.transactionType;
145
+ id: string;
146
+ };
147
+ typeOf: {
148
+ $in: factory.actionType[];
149
+ };
150
+ }): Promise<{
151
+ deletedCount?: number;
152
+ } | null>;
125
153
  aggregateAuthorizeEventServiceOfferAction(params: {
126
154
  project?: {
127
155
  id?: {
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const factory = require("../factory");
14
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
14
  const action_1 = require("./mongoose/schemas/action");
16
15
  /**
17
16
  * アクションリポジトリ
@@ -19,13 +18,10 @@ const action_1 = require("./mongoose/schemas/action");
19
18
  class MongoRepository {
20
19
  constructor(connection) {
21
20
  this.actionModel = connection.model(action_1.modelName, action_1.schema);
22
- if (connection.get('autoIndex') === true) {
23
- this.actionModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
- }
25
21
  }
26
22
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
27
23
  static CREATE_MONGO_CONDITIONS(params) {
28
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53;
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65;
29
25
  const andConditions = [];
30
26
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
31
27
  // tslint:disable-next-line:no-single-line-block-comment
@@ -79,9 +75,27 @@ class MongoRepository {
79
75
  }
80
76
  });
81
77
  }
78
+ const objectMovieTicketsIdentifierEq = (_o = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.movieTickets) === null || _m === void 0 ? void 0 : _m.identifier) === null || _o === void 0 ? void 0 : _o.$eq;
79
+ if (typeof objectMovieTicketsIdentifierEq === 'string') {
80
+ andConditions.push({
81
+ 'object.movieTickets.identifier': {
82
+ $exists: true,
83
+ $eq: objectMovieTicketsIdentifierEq
84
+ }
85
+ });
86
+ }
87
+ const objectMovieTicketsServiceOutputReservationForIdEq = (_t = (_s = (_r = (_q = (_p = params.object) === null || _p === void 0 ? void 0 : _p.movieTickets) === null || _q === void 0 ? void 0 : _q.serviceOutput) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
88
+ if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
89
+ andConditions.push({
90
+ 'object.movieTickets.serviceOutput.reservationFor.id': {
91
+ $exists: true,
92
+ $eq: objectMovieTicketsServiceOutputReservationForIdEq
93
+ }
94
+ });
95
+ }
82
96
  // tslint:disable-next-line:no-single-line-block-comment
83
97
  /* istanbul ignore else */
84
- const objectPaymentMethodIdEq = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.paymentMethodId) === null || _m === void 0 ? void 0 : _m.$eq;
98
+ const objectPaymentMethodIdEq = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethodId) === null || _v === void 0 ? void 0 : _v.$eq;
85
99
  if (typeof objectPaymentMethodIdEq === 'string') {
86
100
  andConditions.push({
87
101
  'object.paymentMethodId': {
@@ -90,7 +104,7 @@ class MongoRepository {
90
104
  }
91
105
  });
92
106
  }
93
- const objectObjectPaymentMethodIdEq = (_q = (_p = (_o = params.object) === null || _o === void 0 ? void 0 : _o.object) === null || _p === void 0 ? void 0 : _p.paymentMethodId) === null || _q === void 0 ? void 0 : _q.$eq;
107
+ const objectObjectPaymentMethodIdEq = (_y = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.object) === null || _x === void 0 ? void 0 : _x.paymentMethodId) === null || _y === void 0 ? void 0 : _y.$eq;
94
108
  if (typeof objectObjectPaymentMethodIdEq === 'string') {
95
109
  andConditions.push({
96
110
  'object.object.paymentMethodId': {
@@ -99,7 +113,7 @@ class MongoRepository {
99
113
  }
100
114
  });
101
115
  }
102
- const objectReservationForIdEq = (_t = (_s = (_r = params.object) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
116
+ const objectReservationForIdEq = (_1 = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
103
117
  // tslint:disable-next-line:no-single-line-block-comment
104
118
  /* istanbul ignore else */
105
119
  if (typeof objectReservationForIdEq === 'string') {
@@ -110,7 +124,25 @@ class MongoRepository {
110
124
  }
111
125
  });
112
126
  }
113
- const objectPaymentMethodAccountIdEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethod) === null || _v === void 0 ? void 0 : _v.accountId) === null || _w === void 0 ? void 0 : _w.$eq;
127
+ const objectReservationNumberEq = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.reservationNumber) === null || _3 === void 0 ? void 0 : _3.$eq;
128
+ if (typeof objectReservationNumberEq === 'string') {
129
+ andConditions.push({
130
+ 'object.reservationNumber': {
131
+ $exists: true,
132
+ $eq: objectReservationNumberEq
133
+ }
134
+ });
135
+ }
136
+ const objectReservationNumberIn = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.reservationNumber) === null || _5 === void 0 ? void 0 : _5.$in;
137
+ if (Array.isArray(objectReservationNumberIn)) {
138
+ andConditions.push({
139
+ 'object.reservationNumber': {
140
+ $exists: true,
141
+ $in: objectReservationNumberIn
142
+ }
143
+ });
144
+ }
145
+ const objectPaymentMethodAccountIdEq = (_8 = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.paymentMethod) === null || _7 === void 0 ? void 0 : _7.accountId) === null || _8 === void 0 ? void 0 : _8.$eq;
114
146
  // tslint:disable-next-line:no-single-line-block-comment
115
147
  /* istanbul ignore else */
116
148
  if (typeof objectPaymentMethodAccountIdEq === 'string') {
@@ -121,7 +153,7 @@ class MongoRepository {
121
153
  }
122
154
  });
123
155
  }
124
- const objectPaymentMethodPaymentMethodIdEq = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.paymentMethod) === null || _y === void 0 ? void 0 : _y.paymentMethodId) === null || _z === void 0 ? void 0 : _z.$eq;
156
+ const objectPaymentMethodPaymentMethodIdEq = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.paymentMethod) === null || _10 === void 0 ? void 0 : _10.paymentMethodId) === null || _11 === void 0 ? void 0 : _11.$eq;
125
157
  // tslint:disable-next-line:no-single-line-block-comment
126
158
  /* istanbul ignore else */
127
159
  if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
@@ -132,7 +164,7 @@ class MongoRepository {
132
164
  }
133
165
  });
134
166
  }
135
- const objectPaymentMethodPaymentMethodIdIn = (_2 = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.paymentMethod) === null || _1 === void 0 ? void 0 : _1.paymentMethodId) === null || _2 === void 0 ? void 0 : _2.$in;
167
+ const objectPaymentMethodPaymentMethodIdIn = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.paymentMethod) === null || _13 === void 0 ? void 0 : _13.paymentMethodId) === null || _14 === void 0 ? void 0 : _14.$in;
136
168
  if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
137
169
  andConditions.push({
138
170
  'object.paymentMethod.paymentMethodId': {
@@ -141,7 +173,7 @@ class MongoRepository {
141
173
  }
142
174
  });
143
175
  }
144
- const objectPaymentMethodTypeOfEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.paymentMethod) === null || _4 === void 0 ? void 0 : _4.typeOf) === null || _5 === void 0 ? void 0 : _5.$eq;
176
+ const objectPaymentMethodTypeOfEq = (_17 = (_16 = (_15 = params.object) === null || _15 === void 0 ? void 0 : _15.paymentMethod) === null || _16 === void 0 ? void 0 : _16.typeOf) === null || _17 === void 0 ? void 0 : _17.$eq;
145
177
  // tslint:disable-next-line:no-single-line-block-comment
146
178
  /* istanbul ignore else */
147
179
  if (typeof objectPaymentMethodTypeOfEq === 'string') {
@@ -152,7 +184,7 @@ class MongoRepository {
152
184
  }
153
185
  });
154
186
  }
155
- const objectTypeOfEq = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$eq;
187
+ const objectTypeOfEq = (_19 = (_18 = params.object) === null || _18 === void 0 ? void 0 : _18.typeOf) === null || _19 === void 0 ? void 0 : _19.$eq;
156
188
  // tslint:disable-next-line:no-single-line-block-comment
157
189
  /* istanbul ignore else */
158
190
  if (typeof objectTypeOfEq === 'string') {
@@ -163,7 +195,7 @@ class MongoRepository {
163
195
  }
164
196
  });
165
197
  }
166
- const objectTypeOfIn = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.typeOf) === null || _9 === void 0 ? void 0 : _9.$in;
198
+ const objectTypeOfIn = (_21 = (_20 = params.object) === null || _20 === void 0 ? void 0 : _20.typeOf) === null || _21 === void 0 ? void 0 : _21.$in;
167
199
  if (Array.isArray(objectTypeOfIn)) {
168
200
  andConditions.push({
169
201
  'object.typeOf': {
@@ -172,7 +204,7 @@ class MongoRepository {
172
204
  }
173
205
  });
174
206
  }
175
- const objectIdEq = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
207
+ const objectIdEq = (_23 = (_22 = params.object) === null || _22 === void 0 ? void 0 : _22.id) === null || _23 === void 0 ? void 0 : _23.$eq;
176
208
  // tslint:disable-next-line:no-single-line-block-comment
177
209
  /* istanbul ignore else */
178
210
  if (typeof objectIdEq === 'string') {
@@ -183,7 +215,7 @@ class MongoRepository {
183
215
  }
184
216
  });
185
217
  }
186
- const objectIdIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.id) === null || _13 === void 0 ? void 0 : _13.$in;
218
+ const objectIdIn = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$in;
187
219
  if (Array.isArray(objectIdIn)) {
188
220
  andConditions.push({
189
221
  'object.id': {
@@ -192,7 +224,7 @@ class MongoRepository {
192
224
  }
193
225
  });
194
226
  }
195
- const objectOrderNumberIn = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.orderNumber) === null || _15 === void 0 ? void 0 : _15.$in;
227
+ const objectOrderNumberIn = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.orderNumber) === null || _27 === void 0 ? void 0 : _27.$in;
196
228
  if (Array.isArray(objectOrderNumberIn)) {
197
229
  andConditions.push({
198
230
  'object.orderNumber': {
@@ -201,7 +233,7 @@ class MongoRepository {
201
233
  }
202
234
  });
203
235
  }
204
- const objectEventIdIn = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.event) === null || _17 === void 0 ? void 0 : _17.id) === null || _18 === void 0 ? void 0 : _18.$in;
236
+ const objectEventIdIn = (_30 = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.event) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$in;
205
237
  if (Array.isArray(objectEventIdIn)) {
206
238
  andConditions.push({
207
239
  'object.event.id': {
@@ -210,7 +242,7 @@ class MongoRepository {
210
242
  }
211
243
  });
212
244
  }
213
- const objectAcceptedOfferSeatNumberIn = (_25 = (_24 = (_23 = (_22 = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.acceptedOffer) === null || _20 === void 0 ? void 0 : _20.itemOffered) === null || _21 === void 0 ? void 0 : _21.serviceOutput) === null || _22 === void 0 ? void 0 : _22.reservedTicket) === null || _23 === void 0 ? void 0 : _23.ticketedSeat) === null || _24 === void 0 ? void 0 : _24.seatNumber) === null || _25 === void 0 ? void 0 : _25.$in;
245
+ const objectAcceptedOfferSeatNumberIn = (_37 = (_36 = (_35 = (_34 = (_33 = (_32 = (_31 = params.object) === null || _31 === void 0 ? void 0 : _31.acceptedOffer) === null || _32 === void 0 ? void 0 : _32.itemOffered) === null || _33 === void 0 ? void 0 : _33.serviceOutput) === null || _34 === void 0 ? void 0 : _34.reservedTicket) === null || _35 === void 0 ? void 0 : _35.ticketedSeat) === null || _36 === void 0 ? void 0 : _36.seatNumber) === null || _37 === void 0 ? void 0 : _37.$in;
214
246
  if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
215
247
  andConditions.push({
216
248
  'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
@@ -227,7 +259,7 @@ class MongoRepository {
227
259
  });
228
260
  }
229
261
  else {
230
- const typeOfEq = (_26 = params.typeOf) === null || _26 === void 0 ? void 0 : _26.$eq;
262
+ const typeOfEq = (_38 = params.typeOf) === null || _38 === void 0 ? void 0 : _38.$eq;
231
263
  // tslint:disable-next-line:no-single-line-block-comment
232
264
  /* istanbul ignore else */
233
265
  if (typeof typeOfEq === 'string') {
@@ -236,7 +268,7 @@ class MongoRepository {
236
268
  });
237
269
  }
238
270
  }
239
- const actionStatusIn = (_27 = params.actionStatus) === null || _27 === void 0 ? void 0 : _27.$in;
271
+ const actionStatusIn = (_39 = params.actionStatus) === null || _39 === void 0 ? void 0 : _39.$in;
240
272
  // tslint:disable-next-line:no-single-line-block-comment
241
273
  /* istanbul ignore else */
242
274
  if (Array.isArray(actionStatusIn)) {
@@ -267,7 +299,7 @@ class MongoRepository {
267
299
  startDate: { $lte: startDateLte }
268
300
  });
269
301
  }
270
- const fromLocationTypeOfIn = (_29 = (_28 = params.fromLocation) === null || _28 === void 0 ? void 0 : _28.typeOf) === null || _29 === void 0 ? void 0 : _29.$in;
302
+ const fromLocationTypeOfIn = (_41 = (_40 = params.fromLocation) === null || _40 === void 0 ? void 0 : _40.typeOf) === null || _41 === void 0 ? void 0 : _41.$in;
271
303
  if (Array.isArray(fromLocationTypeOfIn)) {
272
304
  andConditions.push({
273
305
  'fromLocation.typeOf': {
@@ -276,7 +308,7 @@ class MongoRepository {
276
308
  }
277
309
  });
278
310
  }
279
- const fromLocationAccountNumberIn = (_31 = (_30 = params.fromLocation) === null || _30 === void 0 ? void 0 : _30.accountNumber) === null || _31 === void 0 ? void 0 : _31.$in;
311
+ const fromLocationAccountNumberIn = (_43 = (_42 = params.fromLocation) === null || _42 === void 0 ? void 0 : _42.accountNumber) === null || _43 === void 0 ? void 0 : _43.$in;
280
312
  if (Array.isArray(fromLocationAccountNumberIn)) {
281
313
  andConditions.push({
282
314
  'fromLocation.accountNumber': {
@@ -285,7 +317,7 @@ class MongoRepository {
285
317
  }
286
318
  });
287
319
  }
288
- const fromLocationAccountTypeIn = (_33 = (_32 = params.fromLocation) === null || _32 === void 0 ? void 0 : _32.accountType) === null || _33 === void 0 ? void 0 : _33.$in;
320
+ const fromLocationAccountTypeIn = (_45 = (_44 = params.fromLocation) === null || _44 === void 0 ? void 0 : _44.accountType) === null || _45 === void 0 ? void 0 : _45.$in;
289
321
  if (Array.isArray(fromLocationAccountTypeIn)) {
290
322
  andConditions.push({
291
323
  'fromLocation.accountType': {
@@ -294,7 +326,7 @@ class MongoRepository {
294
326
  }
295
327
  });
296
328
  }
297
- const toLocationTypeOfIn = (_35 = (_34 = params.toLocation) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$in;
329
+ const toLocationTypeOfIn = (_47 = (_46 = params.toLocation) === null || _46 === void 0 ? void 0 : _46.typeOf) === null || _47 === void 0 ? void 0 : _47.$in;
298
330
  if (Array.isArray(toLocationTypeOfIn)) {
299
331
  andConditions.push({
300
332
  'toLocation.typeOf': {
@@ -303,7 +335,7 @@ class MongoRepository {
303
335
  }
304
336
  });
305
337
  }
306
- const toLocationAccountNumberIn = (_37 = (_36 = params.toLocation) === null || _36 === void 0 ? void 0 : _36.accountNumber) === null || _37 === void 0 ? void 0 : _37.$in;
338
+ const toLocationAccountNumberIn = (_49 = (_48 = params.toLocation) === null || _48 === void 0 ? void 0 : _48.accountNumber) === null || _49 === void 0 ? void 0 : _49.$in;
307
339
  if (Array.isArray(toLocationAccountNumberIn)) {
308
340
  andConditions.push({
309
341
  'toLocation.accountNumber': {
@@ -312,7 +344,7 @@ class MongoRepository {
312
344
  }
313
345
  });
314
346
  }
315
- const toLocationAccountTypeIn = (_39 = (_38 = params.toLocation) === null || _38 === void 0 ? void 0 : _38.accountType) === null || _39 === void 0 ? void 0 : _39.$in;
347
+ const toLocationAccountTypeIn = (_51 = (_50 = params.toLocation) === null || _50 === void 0 ? void 0 : _50.accountType) === null || _51 === void 0 ? void 0 : _51.$in;
316
348
  if (Array.isArray(toLocationAccountTypeIn)) {
317
349
  andConditions.push({
318
350
  'toLocation.accountType': {
@@ -321,7 +353,7 @@ class MongoRepository {
321
353
  }
322
354
  });
323
355
  }
324
- const purposeTypeOfIn = (_41 = (_40 = params.purpose) === null || _40 === void 0 ? void 0 : _40.typeOf) === null || _41 === void 0 ? void 0 : _41.$in;
356
+ const purposeTypeOfIn = (_53 = (_52 = params.purpose) === null || _52 === void 0 ? void 0 : _52.typeOf) === null || _53 === void 0 ? void 0 : _53.$in;
325
357
  if (Array.isArray(purposeTypeOfIn)) {
326
358
  andConditions.push({
327
359
  'purpose.typeOf': {
@@ -330,7 +362,7 @@ class MongoRepository {
330
362
  }
331
363
  });
332
364
  }
333
- const purposeIdIn = (_43 = (_42 = params.purpose) === null || _42 === void 0 ? void 0 : _42.id) === null || _43 === void 0 ? void 0 : _43.$in;
365
+ const purposeIdIn = (_55 = (_54 = params.purpose) === null || _54 === void 0 ? void 0 : _54.id) === null || _55 === void 0 ? void 0 : _55.$in;
334
366
  if (Array.isArray(purposeIdIn)) {
335
367
  andConditions.push({
336
368
  'purpose.id': {
@@ -339,7 +371,7 @@ class MongoRepository {
339
371
  }
340
372
  });
341
373
  }
342
- const purposeOrderNumberIn = (_45 = (_44 = params.purpose) === null || _44 === void 0 ? void 0 : _44.orderNumber) === null || _45 === void 0 ? void 0 : _45.$in;
374
+ const purposeOrderNumberIn = (_57 = (_56 = params.purpose) === null || _56 === void 0 ? void 0 : _56.orderNumber) === null || _57 === void 0 ? void 0 : _57.$in;
343
375
  if (Array.isArray(purposeOrderNumberIn)) {
344
376
  andConditions.push({
345
377
  'purpose.orderNumber': {
@@ -348,7 +380,7 @@ class MongoRepository {
348
380
  }
349
381
  });
350
382
  }
351
- const resultTypeOfIn = (_47 = (_46 = params.result) === null || _46 === void 0 ? void 0 : _46.typeOf) === null || _47 === void 0 ? void 0 : _47.$in;
383
+ const resultTypeOfIn = (_59 = (_58 = params.result) === null || _58 === void 0 ? void 0 : _58.typeOf) === null || _59 === void 0 ? void 0 : _59.$in;
352
384
  if (Array.isArray(resultTypeOfIn)) {
353
385
  andConditions.push({
354
386
  'result.typeOf': {
@@ -357,7 +389,7 @@ class MongoRepository {
357
389
  }
358
390
  });
359
391
  }
360
- const resultIdIn = (_49 = (_48 = params.result) === null || _48 === void 0 ? void 0 : _48.id) === null || _49 === void 0 ? void 0 : _49.$in;
392
+ const resultIdIn = (_61 = (_60 = params.result) === null || _60 === void 0 ? void 0 : _60.id) === null || _61 === void 0 ? void 0 : _61.$in;
361
393
  if (Array.isArray(resultIdIn)) {
362
394
  andConditions.push({
363
395
  'result.id': {
@@ -366,7 +398,7 @@ class MongoRepository {
366
398
  }
367
399
  });
368
400
  }
369
- const resultOrderNumberIn = (_51 = (_50 = params.result) === null || _50 === void 0 ? void 0 : _50.orderNumber) === null || _51 === void 0 ? void 0 : _51.$in;
401
+ const resultOrderNumberIn = (_63 = (_62 = params.result) === null || _62 === void 0 ? void 0 : _62.orderNumber) === null || _63 === void 0 ? void 0 : _63.$in;
370
402
  if (Array.isArray(resultOrderNumberIn)) {
371
403
  andConditions.push({
372
404
  'result.orderNumber': {
@@ -375,7 +407,7 @@ class MongoRepository {
375
407
  }
376
408
  });
377
409
  }
378
- const resultCodeIn = (_53 = (_52 = params.result) === null || _52 === void 0 ? void 0 : _52.code) === null || _53 === void 0 ? void 0 : _53.$in;
410
+ const resultCodeIn = (_65 = (_64 = params.result) === null || _64 === void 0 ? void 0 : _64.code) === null || _65 === void 0 ? void 0 : _65.$in;
379
411
  if (Array.isArray(resultCodeIn)) {
380
412
  andConditions.push({
381
413
  'result.code': {
@@ -532,32 +564,16 @@ class MongoRepository {
532
564
  * 取引に対するアクション検索時などに使用
533
565
  */
534
566
  searchByPurpose(params) {
535
- var _a;
567
+ var _a, _b, _c, _d, _e, _f;
536
568
  return __awaiter(this, void 0, void 0, function* () {
537
- const conditions = {
538
- 'purpose.typeOf': {
539
- $exists: true,
540
- $eq: params.purpose.typeOf
541
- }
542
- };
543
- if (params.typeOf !== undefined) {
544
- conditions.typeOf = params.typeOf;
545
- }
546
- if (params.purpose.id !== undefined) {
547
- conditions['purpose.id'] = {
548
- $exists: true,
549
- $eq: params.purpose.id
550
- };
551
- }
552
- const query = this.actionModel.find(conditions)
553
- .select({ __v: 0, createdAt: 0, updatedAt: 0 });
554
- // tslint:disable-next-line:no-single-line-block-comment
555
- /* istanbul ignore else */
556
- if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
557
- query.sort({ startDate: params.sort.startDate });
558
- }
559
- return query.exec()
560
- .then((docs) => docs.map((doc) => doc.toObject()));
569
+ return this.search(Object.assign(Object.assign(Object.assign({ purpose: {
570
+ id: { $in: [params.purpose.id] },
571
+ typeOf: { $in: [params.purpose.typeOf] }
572
+ }, object: Object.assign(Object.assign({}, (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf) === null || _b === void 0 ? void 0 : _b.$eq) === 'string')
573
+ ? { typeOf: { $eq: params.object.typeOf.$eq } }
574
+ : undefined), (typeof ((_d = (_c = params.object) === null || _c === void 0 ? void 0 : _c.paymentMethodId) === null || _d === void 0 ? void 0 : _d.$eq) === 'string')
575
+ ? { paymentMethodId: { $eq: params.object.paymentMethodId.$eq } }
576
+ : undefined) }, (typeof ((_e = params.actionStatus) === null || _e === void 0 ? void 0 : _e.$eq) === 'string') ? { actionStatus: { $in: [params.actionStatus.$eq] } } : undefined), (typeof params.typeOf === 'string') ? { typeOf: { $eq: params.typeOf } } : undefined), (typeof ((_f = params.sort) === null || _f === void 0 ? void 0 : _f.startDate) === 'number') ? { sort: params.sort } : undefined), [], []);
561
577
  });
562
578
  }
563
579
  /**
@@ -695,6 +711,29 @@ class MongoRepository {
695
711
  .exec();
696
712
  });
697
713
  }
714
+ /**
715
+ * 取引からアクションを削除する
716
+ */
717
+ deleteByPurpose(params) {
718
+ return __awaiter(this, void 0, void 0, function* () {
719
+ return this.actionModel.deleteMany({
720
+ 'project.id': { $eq: params.project.id },
721
+ typeOf: { $in: params.typeOf.$in },
722
+ 'purpose.id': { $exists: true, $eq: params.purpose.id },
723
+ 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf }
724
+ })
725
+ .exec()
726
+ .then((result) => {
727
+ return {
728
+ // n: result?.n,
729
+ // opTime: result.opTime,
730
+ // ok: result?.ok,
731
+ // operationTime,
732
+ deletedCount: result === null || result === void 0 ? void 0 : result.deletedCount
733
+ };
734
+ });
735
+ });
736
+ }
698
737
  aggregateAuthorizeEventServiceOfferAction(params) {
699
738
  return __awaiter(this, void 0, void 0, function* () {
700
739
  const statuses = yield Promise.all([
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
24
  const additionalProperty_1 = require("./mongoose/schemas/additionalProperty");
26
25
  const factory = require("../factory");
27
26
  /**
@@ -30,9 +29,6 @@ const factory = require("../factory");
30
29
  class MongoRepository {
31
30
  constructor(connection) {
32
31
  this.additionalPropertyModel = connection.model(additionalProperty_1.modelName, additionalProperty_1.schema);
33
- if (connection.get('autoIndex') === true) {
34
- this.additionalPropertyModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
- }
36
32
  }
37
33
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
38
34
  static CREATE_MONGO_CONDITIONS(params) {
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = exports.AggregationType = void 0;
24
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
24
  const aggregation_1 = require("./mongoose/schemas/aggregation");
26
25
  var AggregationType;
27
26
  (function (AggregationType) {
@@ -43,9 +42,6 @@ var AggregationType;
43
42
  class MongoRepository {
44
43
  constructor(connection) {
45
44
  this.aggregationModel = connection.model(aggregation_1.modelName, aggregation_1.schema);
46
- if (connection.get('autoIndex') === true) {
47
- this.aggregationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
48
- }
49
45
  }
50
46
  saveAggregation(params) {
51
47
  return __awaiter(this, void 0, void 0, function* () {