@chevre/domain 25.2.0-alpha.9 → 26.0.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 (260) hide show
  1. package/lib/chevre/eventEmitter/task.d.ts +2 -1
  2. package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
  3. package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
  4. package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
  5. package/lib/chevre/repo/action/acceptPay.js +47 -19
  6. package/lib/chevre/repo/action.d.ts +16 -9
  7. package/lib/chevre/repo/action.js +99 -180
  8. package/lib/chevre/repo/adminTask.d.ts +37 -0
  9. package/lib/chevre/repo/adminTask.js +163 -0
  10. package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
  11. package/lib/chevre/repo/aggregateOffer.js +16 -125
  12. package/lib/chevre/repo/aggregateTask.d.ts +37 -0
  13. package/lib/chevre/repo/aggregateTask.js +136 -0
  14. package/lib/chevre/repo/asyncAction.d.ts +69 -0
  15. package/lib/chevre/repo/asyncAction.js +237 -0
  16. package/lib/chevre/repo/concurrentLock.d.ts +3 -1
  17. package/lib/chevre/repo/creativeWork.d.ts +2 -3
  18. package/lib/chevre/repo/credentials.d.ts +2 -1
  19. package/lib/chevre/repo/customerType.d.ts +2 -3
  20. package/lib/chevre/repo/event.d.ts +10 -11
  21. package/lib/chevre/repo/eventOffer.d.ts +4 -5
  22. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
  23. package/lib/chevre/repo/eventSeries.d.ts +4 -5
  24. package/lib/chevre/repo/message.d.ts +1 -1
  25. package/lib/chevre/repo/message.js +1 -1
  26. package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +13 -0
  27. package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
  28. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
  29. package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
  30. package/lib/chevre/repo/mongoose/schemas/scheduledTasks.d.ts +16 -0
  31. package/lib/chevre/repo/mongoose/schemas/scheduledTasks.js +103 -0
  32. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
  33. package/lib/chevre/repo/mongoose/schemas/task.d.ts +6 -1
  34. package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
  35. package/lib/chevre/repo/note.d.ts +3 -4
  36. package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
  37. package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +2 -2
  38. package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
  39. package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
  40. package/lib/chevre/repo/offerCatalog.d.ts +2 -3
  41. package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
  42. package/lib/chevre/repo/order.d.ts +2 -0
  43. package/lib/chevre/repo/order.js +14 -14
  44. package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
  45. package/lib/chevre/repo/orderInTransaction.js +181 -3
  46. package/lib/chevre/repo/passport.d.ts +2 -1
  47. package/lib/chevre/repo/person.d.ts +0 -15
  48. package/lib/chevre/repo/person.js +122 -108
  49. package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
  50. package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
  51. package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
  52. package/lib/chevre/repo/place/seat.d.ts +4 -5
  53. package/lib/chevre/repo/place/section.d.ts +3 -4
  54. package/lib/chevre/repo/priceSpecification.d.ts +4 -4
  55. package/lib/chevre/repo/product.d.ts +3 -4
  56. package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
  57. package/lib/chevre/repo/rateLimit/offer.js +0 -12
  58. package/lib/chevre/repo/reservation.d.ts +2 -3
  59. package/lib/chevre/repo/scheduledTask.d.ts +90 -0
  60. package/lib/chevre/repo/scheduledTask.js +223 -0
  61. package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
  62. package/lib/chevre/repo/stockHolder.d.ts +1 -1
  63. package/lib/chevre/repo/stockHolder.js +0 -146
  64. package/lib/chevre/repo/task.d.ts +30 -71
  65. package/lib/chevre/repo/task.js +59 -345
  66. package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
  67. package/lib/chevre/repo/transaction/placeOrder.js +43 -83
  68. package/lib/chevre/repo/transaction.d.ts +2 -2
  69. package/lib/chevre/repo/transactionNumberCounter.js +0 -34
  70. package/lib/chevre/repo/transactionProcess.d.ts +2 -1
  71. package/lib/chevre/repo/transactionProcess.js +0 -13
  72. package/lib/chevre/repository.d.ts +20 -0
  73. package/lib/chevre/repository.js +46 -2
  74. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
  75. package/lib/chevre/service/aggregation/system.d.ts +2 -2
  76. package/lib/chevre/service/aggregation/system.js +1 -1
  77. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -1
  78. package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +1 -1
  79. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  80. package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
  81. package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
  82. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  83. package/lib/chevre/service/assetTransaction/refund.js +1 -1
  84. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +1 -1
  85. package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -67
  86. package/lib/chevre/service/asyncAction.d.ts +16 -0
  87. package/lib/chevre/service/asyncAction.js +36 -0
  88. package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
  89. package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
  90. package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
  91. package/lib/chevre/service/asyncActionHandler.js +89 -0
  92. package/lib/chevre/service/notification/factory.d.ts +2 -4
  93. package/lib/chevre/service/notification/factory.js +26 -24
  94. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +12 -6
  95. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +12 -4
  96. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
  97. package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
  98. package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
  99. package/lib/chevre/service/offer/event/authorize.js +2 -2
  100. package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
  101. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
  102. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
  103. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
  104. package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
  105. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
  106. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +15 -12
  107. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
  108. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
  109. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +4 -0
  110. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +20 -9
  111. package/lib/chevre/service/offer/onEventChanged.js +2 -2
  112. package/lib/chevre/service/order/confirmPayTransaction.js +1 -1
  113. package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
  114. package/lib/chevre/service/order/deleteOrder.js +8 -1
  115. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
  116. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
  117. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
  118. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
  119. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
  120. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
  121. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  122. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
  123. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
  124. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  125. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
  126. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +3 -3
  127. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +0 -3
  128. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +73 -44
  129. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
  130. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +53 -33
  131. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
  132. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
  133. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +6 -4
  134. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  135. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +3 -7
  136. package/lib/chevre/service/order/onOrderUpdated.js +1 -1
  137. package/lib/chevre/service/order/payOrder.d.ts +2 -0
  138. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
  139. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
  140. package/lib/chevre/service/order/placeOrder/factory.js +3 -21
  141. package/lib/chevre/service/order/placeOrder.d.ts +4 -5
  142. package/lib/chevre/service/order/placeOrder.js +20 -31
  143. package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
  144. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
  145. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
  146. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
  147. package/lib/chevre/service/payment/any/authorize.js +7 -5
  148. package/lib/chevre/service/payment/any/factory.d.ts +7 -7
  149. package/lib/chevre/service/payment/any/factory.js +18 -21
  150. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +7 -1
  151. package/lib/chevre/service/payment/any/findAcceptAction.js +34 -15
  152. package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +4 -0
  153. package/lib/chevre/service/payment/any/findAuthorizeAction.js +20 -9
  154. package/lib/chevre/service/payment/any/findCheckAction.d.ts +4 -0
  155. package/lib/chevre/service/payment/any/findCheckAction.js +20 -9
  156. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
  157. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +5 -67
  158. package/lib/chevre/service/payment/any/onPayActionCompleted.js +1 -1
  159. package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.js +1 -1
  160. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
  161. package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
  162. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
  163. package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
  164. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  165. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
  166. package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
  167. package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
  168. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +1 -1
  169. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -1
  170. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -1
  171. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +20 -11
  172. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -1
  173. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +1 -1
  174. package/lib/chevre/service/reserve/searchByOrder.js +2 -6
  175. package/lib/chevre/service/reserve.d.ts +2 -2
  176. package/lib/chevre/service/reserve.js +3 -3
  177. package/lib/chevre/service/scheduledTask.d.ts +11 -0
  178. package/lib/chevre/service/scheduledTask.js +40 -0
  179. package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.d.ts +14 -0
  180. package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +56 -0
  181. package/lib/chevre/service/scheduledTaskHandler.d.ts +12 -0
  182. package/lib/chevre/service/scheduledTaskHandler.js +66 -0
  183. package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
  184. package/lib/chevre/service/task/aggregateOffers.js +2 -1
  185. package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
  186. package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
  187. package/lib/chevre/service/task/authorizePayment.js +3 -1
  188. package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
  189. package/lib/chevre/service/task/cancelReservation.js +2 -1
  190. package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
  191. package/lib/chevre/service/task/confirmReserveTransaction.js +3 -8
  192. package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
  193. package/lib/chevre/service/task/deleteTransaction.js +2 -1
  194. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
  195. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
  196. package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
  197. package/lib/chevre/service/task/onEventChanged.js +2 -1
  198. package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
  199. package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
  200. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +2 -2
  201. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +1 -1
  202. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
  203. package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
  204. package/lib/chevre/service/task/onResourceUpdated.js +10 -9
  205. package/lib/chevre/service/task/placeOrder.d.ts +2 -2
  206. package/lib/chevre/service/task/placeOrder.js +6 -3
  207. package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
  208. package/lib/chevre/service/task/refund.d.ts +2 -2
  209. package/lib/chevre/service/task/refund.js +4 -10
  210. package/lib/chevre/service/task/reserve.d.ts +2 -2
  211. package/lib/chevre/service/task/reserve.js +2 -1
  212. package/lib/chevre/service/task/returnOrder.d.ts +2 -2
  213. package/lib/chevre/service/task/returnOrder.js +2 -1
  214. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  215. package/lib/chevre/service/task/sendOrder.d.ts +2 -2
  216. package/lib/chevre/service/task/sendOrder.js +2 -1
  217. package/lib/chevre/service/task/voidPayTransaction.js +3 -7
  218. package/lib/chevre/service/task/voidPayment.d.ts +2 -2
  219. package/lib/chevre/service/task/voidPayment.js +2 -1
  220. package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
  221. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +1 -1
  222. package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -1
  223. package/lib/chevre/service/taskHandler.d.ts +2 -2
  224. package/lib/chevre/service/taskHandler.js +36 -37
  225. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
  226. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
  227. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
  228. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
  229. package/lib/chevre/service/transaction/deleteTransaction.d.ts +1 -1
  230. package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
  231. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
  232. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
  233. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
  234. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
  235. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +32 -4
  236. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +10 -1
  237. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
  238. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +6 -2
  239. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +23 -9
  240. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
  241. package/lib/chevre/service/transaction/placeOrder/confirm.js +30 -40
  242. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
  243. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
  244. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
  245. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
  246. package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
  247. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
  248. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
  249. package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
  250. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
  251. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  252. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  253. package/lib/chevre/service.d.ts +8 -0
  254. package/lib/chevre/service.js +23 -1
  255. package/lib/chevre/taskSettings.d.ts +3 -4
  256. package/package.json +8 -11
  257. package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
  258. package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
  259. package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
  260. package/lib/chevre/service/reserve/findReservations.js +0 -61
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import type { Connection, PipelineStage } from 'mongoose';
1
+ import type { Connection, PipelineStage, mongo } from 'mongoose';
3
2
  import { factory } from '../../factory';
4
3
  type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
5
4
  type ICreatingSection = Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name'>;
@@ -57,7 +56,7 @@ export declare class SectionRepo {
57
56
  addSeatSectionsByBranchCodeIfNotExist(params: {
58
57
  $set: IUpsertingSeatSection;
59
58
  }[], options: IUpsertOptions): Promise<{
60
- bulkWriteResult?: BulkWriteResult;
59
+ bulkWriteResult?: mongo.BulkWriteResult;
61
60
  }>;
62
61
  /**
63
62
  * コードをキーにして冪等編集
@@ -65,7 +64,7 @@ export declare class SectionRepo {
65
64
  updateSeatSectionsByBranchCode(params: {
66
65
  $set: IUpsertingSeatSection;
67
66
  }[], options: IUpsertOptions): Promise<{
68
- bulkWriteResult?: BulkWriteResult;
67
+ bulkWriteResult?: mongo.BulkWriteResult;
69
68
  }>;
70
69
  migrateSectionIdentifier(screeningRoomSection: {
71
70
  project: {
@@ -37,8 +37,8 @@ export declare class PriceSpecificationRepo {
37
37
  };
38
38
  }): Promise<void>;
39
39
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
40
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
41
40
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
41
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
42
42
  price: number;
43
43
  priceCurrency: factory.priceCurrency;
44
44
  typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification;
@@ -53,8 +53,8 @@ export declare class PriceSpecificationRepo {
53
53
  } & {
54
54
  __v: number;
55
55
  }) | ({
56
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
57
56
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
57
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
58
58
  price: number;
59
59
  priceCurrency: factory.priceCurrency;
60
60
  typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
@@ -70,8 +70,8 @@ export declare class PriceSpecificationRepo {
70
70
  } & {
71
71
  __v: number;
72
72
  })), import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
73
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
74
73
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
74
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
75
75
  price: number;
76
76
  priceCurrency: factory.priceCurrency;
77
77
  typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification;
@@ -86,8 +86,8 @@ export declare class PriceSpecificationRepo {
86
86
  } & {
87
87
  __v: number;
88
88
  }) | ({
89
- project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
90
89
  name?: (string | import("@chevre/factory/lib/chevre/multilingualString").IMultilingualString) | undefined;
90
+ project?: Pick<factory.project.IProject, "id" | "typeOf"> | undefined;
91
91
  price: number;
92
92
  priceCurrency: factory.priceCurrency;
93
93
  typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { Connection, FilterQuery, Types } from 'mongoose';
1
+ import { Connection, FilterQuery, Types, mongo } from 'mongoose';
3
2
  import { factory } from '../factory';
4
3
  import { IDocType, IDocTypeAsProduct } from './mongoose/schemas/product';
5
4
  type IKeyOfProjection = keyof factory.product.IProduct | 'hasOfferCatalog.id';
@@ -65,7 +64,7 @@ export declare class ProductRepo {
65
64
  };
66
65
  $unset?: Partial<Record<IUnsetKey, 1>>;
67
66
  }[]): Promise<{
68
- bulkWriteResult?: BulkWriteResult;
67
+ bulkWriteResult?: mongo.BulkWriteResult;
69
68
  modifiedProducts?: {
70
69
  id: string;
71
70
  }[];
@@ -80,7 +79,7 @@ export declare class ProductRepo {
80
79
  hasOfferCatalog: {
81
80
  id: string;
82
81
  };
83
- }): Promise<import("mongodb").DeleteResult>;
82
+ }): Promise<mongo.DeleteResult>;
84
83
  /**
85
84
  * プロジェクト指定で削除する
86
85
  */
@@ -1,5 +1,6 @@
1
- import { RedisClientType } from 'redis';
1
+ import type { createClient } from 'redis';
2
2
  import { factory } from '../../factory';
3
+ type RedisClientType = ReturnType<typeof createClient>;
3
4
  /**
4
5
  * レート制限キーインターフェース
5
6
  */
@@ -34,3 +35,4 @@ export declare class OfferRateLimitRepo {
34
35
  unlock(params: IRateLimitKey): Promise<void>;
35
36
  getHolder(ratelimitKey: IRateLimitKey): Promise<string | null>;
36
37
  }
38
+ export {};
@@ -28,7 +28,6 @@ class OfferRateLimitRepo {
28
28
  * ロックする
29
29
  * discontinue array params(2025-05-26~)
30
30
  */
31
- // public async lock(ratelimitKeys: IRateLimitKey[]): Promise<void> {
32
31
  async lock(params) {
33
32
  const key = OfferRateLimitRepo.createKey(params);
34
33
  const value = params.reservationNumber;
@@ -50,18 +49,8 @@ class OfferRateLimitRepo {
50
49
  catch (_error) {
51
50
  throw new factory_1.factory.errors.RateLimitExceeded('Offer');
52
51
  }
53
- // const multi = this.redisClient.multi();
54
- // multi.setNX(key, value)
55
- // .expire(key, ttl);
56
- // const results = await multi.exec();
57
- // if (Array.isArray(results) && (results[0] === 1 || (<any>results)[0] === true)) {
58
- // return;
59
- // } else {
60
- // throw new factory.errors.RateLimitExceeded('Offer');
61
- // }
62
52
  }
63
53
  // discontinue array params(2025-05-26~)
64
- // public async unlock(ratelimitKeys: IRateLimitKey[]): Promise<void> {
65
54
  async unlock(params) {
66
55
  const key = OfferRateLimitRepo.createKey(params);
67
56
  // reimplement using concurrentLockRepo(2025-05-27~)
@@ -69,7 +58,6 @@ class OfferRateLimitRepo {
69
58
  about: { identifier: key, typeOf: 'Thing' },
70
59
  audience: { identifier: params.reservationNumber, typeOf: 'Audience' }
71
60
  });
72
- // await this.redisClient.del(key);
73
61
  }
74
62
  async getHolder(ratelimitKey) {
75
63
  const key = OfferRateLimitRepo.createKey(ratelimitKey);
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import type { Connection, UpdateWriteOpResult } from 'mongoose';
1
+ import type { Connection, UpdateWriteOpResult, mongo } from 'mongoose';
3
2
  import { IDocType } from './mongoose/schemas/reservation';
4
3
  import { factory } from '../factory';
5
4
  export interface IUpdatePartiallyParams {
@@ -77,7 +76,7 @@ export declare class ReservationRepo {
77
76
  reservationNumber: string;
78
77
  underName?: factory.reservation.IUnderName;
79
78
  broker?: factory.reservation.IBroker;
80
- }): Promise<BulkWriteResult | undefined>;
79
+ }): Promise<mongo.BulkWriteResult | undefined>;
81
80
  /**
82
81
  * 予約取消
83
82
  */
@@ -0,0 +1,90 @@
1
+ import type { Connection, UpdateWriteOpResult } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ import type { IExecutableTask } from '../taskSettings';
4
+ type ICreatingTaskKeys = 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'description';
5
+ /**
6
+ * リトライ可能なタスク作成属性
7
+ */
8
+ type ICreatingTask = (Pick<factory.task.importEventCapacitiesFromCOA.IAttributes, ICreatingTaskKeys> | Pick<factory.task.importEventsFromCOA.IAttributes, ICreatingTaskKeys>) & {
9
+ expires: Date;
10
+ };
11
+ /**
12
+ * 予定タスクリポジトリ
13
+ */
14
+ export declare class ScheduledTaskRepo {
15
+ private readonly scheduledTaskModel;
16
+ constructor(connection: Connection);
17
+ addScheduledTasks(taskAttributes: ICreatingTask[]): Promise<{
18
+ id: string;
19
+ }[]>;
20
+ countPotentiallyRunningScheduledTasks(params: {
21
+ name: {
22
+ $eq: factory.taskName;
23
+ };
24
+ runsAt: {
25
+ $lt: Date;
26
+ };
27
+ limit?: number;
28
+ }): Promise<{
29
+ count: number;
30
+ }>;
31
+ /**
32
+ * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更
33
+ */
34
+ runScheduledTaskIfExists(params: {
35
+ /**
36
+ * 必ずタスク名指定で実行する
37
+ */
38
+ name: {
39
+ $eq: factory.taskName;
40
+ };
41
+ runsAt: {
42
+ $lt: Date;
43
+ };
44
+ executor: {
45
+ name: string;
46
+ };
47
+ }): Promise<Pick<factory.task.ITask<factory.taskName>, 'id' | 'name'> | null>;
48
+ /**
49
+ * Running -> findOneするだけ
50
+ */
51
+ findRunningScheduledTaskById(params: {
52
+ id: string;
53
+ }): Promise<IExecutableTask<factory.taskName> | null>;
54
+ /**
55
+ * タスクIDから実行結果とステータスを保管する
56
+ * Abortedの場合、dateAbortedもセットする
57
+ */
58
+ setExecutionResultAndStatus(params: {
59
+ /**
60
+ * タスクID
61
+ */
62
+ id: string;
63
+ }, update: {
64
+ status: factory.taskStatus.Executed | factory.taskStatus.Running | factory.taskStatus.Aborted;
65
+ executionResult: factory.task.IExecutionResult;
66
+ }): Promise<void>;
67
+ deleteTooOldReadyTasks(params: {
68
+ project: {
69
+ id: string;
70
+ };
71
+ name: factory.taskName;
72
+ runsAt: {
73
+ $lt: Date;
74
+ };
75
+ }): Promise<import("mongodb").DeleteResult>;
76
+ /**
77
+ * Runningのまま一定期間超過し、かつ、remainingNumberOfTries>0のタスクをReadyに変更する
78
+ */
79
+ retryScheduledTasks(params: {
80
+ intervalInMinutes: number;
81
+ }): Promise<UpdateWriteOpResult>;
82
+ /**
83
+ * $eq:0をAbortedにする(タスク名称に関わらず)
84
+ * これらは中止されてもhubへ通知しない
85
+ */
86
+ abortScheduledTasks(params: {
87
+ intervalInMinutes: number;
88
+ }): Promise<UpdateWriteOpResult>;
89
+ }
90
+ export {};
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ScheduledTaskRepo = void 0;
7
+ const moment_1 = __importDefault(require("moment"));
8
+ const factory_1 = require("../factory");
9
+ const settings_1 = require("../settings");
10
+ const scheduledTasks_1 = require("./mongoose/schemas/scheduledTasks");
11
+ const executableTaskProjection = {
12
+ _id: 0,
13
+ id: { $toString: '$_id' },
14
+ // 必要最低限にprojection(2024-04-23~)
15
+ data: 1,
16
+ name: 1,
17
+ status: 1,
18
+ numberOfTried: 1,
19
+ project: 1,
20
+ remainingNumberOfTries: 1,
21
+ runsAt: 1,
22
+ expires: 1
23
+ };
24
+ /**
25
+ * 予定タスクリポジトリ
26
+ */
27
+ class ScheduledTaskRepo {
28
+ scheduledTaskModel;
29
+ constructor(connection) {
30
+ this.scheduledTaskModel = connection.model(scheduledTasks_1.modelName, (0, scheduledTasks_1.createSchema)());
31
+ }
32
+ async addScheduledTasks(taskAttributes) {
33
+ if (taskAttributes.length > 0) {
34
+ const creatingTasks = taskAttributes;
35
+ const result = await this.scheduledTaskModel.insertMany(creatingTasks, { ordered: false, rawResult: true });
36
+ if (result.insertedCount !== taskAttributes.length) {
37
+ throw new factory_1.factory.errors.Internal('all tasks not saved');
38
+ }
39
+ const savedTasks = Object.values(result.insertedIds)
40
+ .map((objectId) => {
41
+ return { id: objectId.toHexString() };
42
+ });
43
+ // イベントは発火しない
44
+ // if (emitImmediately) {
45
+ // savedTasks.forEach((savedTask) => {
46
+ // taskEventEmitter.emitTaskStatusChanged({
47
+ // id: savedTask.id,
48
+ // status: factory.taskStatus.Ready
49
+ // });
50
+ // });
51
+ // }
52
+ return savedTasks;
53
+ }
54
+ else {
55
+ return [];
56
+ }
57
+ }
58
+ async countPotentiallyRunningScheduledTasks(params) {
59
+ const { runsAt, limit, name } = params;
60
+ const nameEq = name.$eq;
61
+ if (!(runsAt.$lt instanceof Date)) {
62
+ throw new factory_1.factory.errors.Argument('runsAt.$lt', 'must be Date');
63
+ }
64
+ const query = this.scheduledTaskModel.countDocuments({
65
+ status: { $eq: factory_1.factory.taskStatus.Ready },
66
+ name: { $eq: nameEq },
67
+ runsAt: { $lt: params.runsAt.$lt }
68
+ });
69
+ if (typeof limit === 'number' && limit >= 0) {
70
+ query.limit(limit);
71
+ }
72
+ const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
73
+ .exec();
74
+ return { count };
75
+ }
76
+ /**
77
+ * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更
78
+ */
79
+ async runScheduledTaskIfExists(params) {
80
+ if (!(params.runsAt.$lt instanceof Date)) {
81
+ throw new factory_1.factory.errors.Argument('runsAt.$lt', 'must be Date');
82
+ }
83
+ // const { noEmitEvent } = options;
84
+ const projection = {
85
+ _id: 0,
86
+ id: { $toString: '$_id' },
87
+ name: 1
88
+ };
89
+ const nameEq = params.name.$eq;
90
+ const filter = {
91
+ status: { $eq: factory_1.factory.taskStatus.Ready },
92
+ name: { $eq: nameEq },
93
+ runsAt: { $lt: params.runsAt.$lt }
94
+ };
95
+ const doc = await this.scheduledTaskModel.findOneAndUpdate(filter, {
96
+ $set: {
97
+ status: factory_1.factory.taskStatus.Running, // 実行中に変更
98
+ lastTriedAt: new Date(),
99
+ executor: params.executor
100
+ },
101
+ $inc: {
102
+ remainingNumberOfTries: -1, // 残りトライ可能回数減らす
103
+ numberOfTried: 1 // トライ回数増やす
104
+ }
105
+ }, {
106
+ new: true,
107
+ projection,
108
+ sort: { runsAt: factory_1.factory.sortType.Ascending } // ソートは、実行日時で固定化(2026-07-31~)
109
+ // ...(typeof params.sort.numberOfTried === 'number' || typeof params.sort.runsAt === 'number')
110
+ // ? { sort: params.sort }
111
+ // : undefined
112
+ })
113
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
114
+ .lean()
115
+ .exec();
116
+ if (doc === null) {
117
+ return null;
118
+ }
119
+ // if (!noEmitEvent) {
120
+ // const changedTask: IRunningTaskByName = {
121
+ // id: doc.id,
122
+ // status: factory.taskStatus.Running,
123
+ // name: nameEq
124
+ // };
125
+ // taskEventEmitter.emitTaskStatusChanged(
126
+ // changedTask,
127
+ // // 現時点でタスク遅延実行ではnext指定なし(2026-07-30)
128
+ // // (typeof next === 'function') ? next : undefined
129
+ // );
130
+ // }
131
+ return doc;
132
+ }
133
+ /**
134
+ * Running -> findOneするだけ
135
+ */
136
+ async findRunningScheduledTaskById(params) {
137
+ const doc = await this.scheduledTaskModel.findOne({
138
+ _id: { $eq: params.id },
139
+ status: { $eq: factory_1.factory.taskStatus.Running },
140
+ }, executableTaskProjection)
141
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
142
+ .lean()
143
+ .exec();
144
+ if (doc === null) {
145
+ return null;
146
+ }
147
+ return doc;
148
+ }
149
+ /**
150
+ * タスクIDから実行結果とステータスを保管する
151
+ * Abortedの場合、dateAbortedもセットする
152
+ */
153
+ async setExecutionResultAndStatus(params, update) {
154
+ const { id } = params;
155
+ const { status, executionResult } = update;
156
+ await this.scheduledTaskModel.updateOne({ _id: { $eq: id } }, {
157
+ $set: {
158
+ status,
159
+ ...(status === factory_1.factory.taskStatus.Aborted) ? { dateAborted: executionResult.endDate } : undefined // 2025-08-04~
160
+ },
161
+ $push: { executionResults: executionResult }
162
+ })
163
+ .exec();
164
+ }
165
+ async deleteTooOldReadyTasks(params) {
166
+ return this.scheduledTaskModel.deleteMany({
167
+ 'project.id': { $eq: params.project.id },
168
+ name: { $eq: params.name },
169
+ status: { $eq: factory_1.factory.taskStatus.Ready },
170
+ runsAt: { $lt: params.runsAt.$lt }
171
+ })
172
+ .exec();
173
+ }
174
+ /**
175
+ * Runningのまま一定期間超過し、かつ、remainingNumberOfTries>0のタスクをReadyに変更する
176
+ */
177
+ async retryScheduledTasks(params) {
178
+ const lastTriedAtShoudBeLessThan = (0, moment_1.default)()
179
+ .add(-params.intervalInMinutes, 'minutes')
180
+ .toDate();
181
+ return this.scheduledTaskModel.updateMany(
182
+ // retryOrAbortScheduledTasksインデックスと連動
183
+ {
184
+ status: { $eq: factory_1.factory.taskStatus.Running },
185
+ remainingNumberOfTries: { $gte: 1 }, // まだリトライ可能なもの
186
+ lastTriedAt: {
187
+ $exists: true,
188
+ $lt: lastTriedAtShoudBeLessThan
189
+ },
190
+ }, {
191
+ $set: {
192
+ status: factory_1.factory.taskStatus.Ready // 実行前に変更
193
+ }
194
+ })
195
+ .exec();
196
+ }
197
+ /**
198
+ * $eq:0をAbortedにする(タスク名称に関わらず)
199
+ * これらは中止されてもhubへ通知しない
200
+ */
201
+ async abortScheduledTasks(params) {
202
+ const lastTriedAtShoudBeLessThan = (0, moment_1.default)()
203
+ .add(-params.intervalInMinutes, 'minutes')
204
+ .toDate();
205
+ return this.scheduledTaskModel.updateMany(
206
+ // retryOrAbortScheduledTasksインデックスと連動
207
+ {
208
+ status: { $eq: factory_1.factory.taskStatus.Running },
209
+ remainingNumberOfTries: { $eq: 0 },
210
+ lastTriedAt: {
211
+ $exists: true,
212
+ $lt: lastTriedAtShoudBeLessThan
213
+ },
214
+ }, {
215
+ $set: {
216
+ status: factory_1.factory.taskStatus.Aborted,
217
+ dateAborted: new Date()
218
+ }
219
+ })
220
+ .exec();
221
+ }
222
+ }
223
+ exports.ScheduledTaskRepo = ScheduledTaskRepo;
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { Connection } from 'mongoose';
1
+ import { Connection, mongo } from 'mongoose';
3
2
  import { factory } from '../factory';
4
3
  type IMakesOffer = Pick<factory.seller.IMakesOffer, 'typeOf' | 'availableAtOrFrom' | 'eligibleTransactionDuration'>;
5
4
  type IMakesOfferAsFindResult = IMakesOffer & {
@@ -51,7 +50,7 @@ export declare class SellerMakesOfferRepo {
51
50
  id: string;
52
51
  };
53
52
  }[];
54
- }): Promise<BulkWriteResult | undefined>;
53
+ }): Promise<mongo.BulkWriteResult | undefined>;
55
54
  /**
56
55
  * 販売者とアプリケーションに対してオファーが存在すれば削除する
57
56
  */
@@ -67,6 +66,6 @@ export declare class SellerMakesOfferRepo {
67
66
  id: string;
68
67
  };
69
68
  }[];
70
- }): Promise<BulkWriteResult | undefined>;
69
+ }): Promise<mongo.BulkWriteResult | undefined>;
71
70
  }
72
71
  export {};
@@ -16,7 +16,7 @@ export declare class StockHolderRepo implements AbstractStockHolderRepo {
16
16
  /**
17
17
  * 座席をロックする
18
18
  */
19
- lock(lockKey: ILockKey & {}): Promise<void>;
19
+ lock(lockKey: ILockKey): Promise<void>;
20
20
  /**
21
21
  * 座席ロックを解除する
22
22
  */