@chevre/domain 26.0.0-alpha.9 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/eventEmitter/task.d.ts +8 -23
- package/lib/chevre/eventEmitter/task.js +2 -2
- package/lib/chevre/repo/acceptedOffer.d.ts +0 -7
- package/lib/chevre/repo/acceptedOffer.js +27 -27
- package/lib/chevre/repo/action/acceptCOAOffer.d.ts +3 -1
- package/lib/chevre/repo/action/acceptCOAOffer.js +8 -2
- package/lib/chevre/repo/action/acceptPay.d.ts +3 -1
- package/lib/chevre/repo/action/acceptPay.js +8 -4
- package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +120 -0
- package/lib/chevre/repo/action/{actionProcess.js → anyAction/actionProcess.js} +28 -157
- package/lib/chevre/repo/action/anyAction/actionRecipe.d.ts +37 -0
- package/lib/chevre/repo/action/anyAction/actionRecipe.js +53 -0
- package/lib/chevre/repo/action/authorizeInvoice.d.ts +5 -8
- package/lib/chevre/repo/action/authorizeInvoice.js +7 -4
- package/lib/chevre/repo/action/authorizeOffer.d.ts +3 -1
- package/lib/chevre/repo/action/authorizeOffer.js +7 -2
- package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +3 -1
- package/lib/chevre/repo/action/authorizePaymentMethod.js +7 -4
- package/lib/chevre/repo/action/authorizeTicketedObject.d.ts +3 -1
- package/lib/chevre/repo/action/authorizeTicketedObject.js +7 -2
- package/lib/chevre/repo/action/cancel.d.ts +25 -0
- package/lib/chevre/repo/action/cancel.js +47 -0
- package/lib/chevre/repo/action/checkMovieTicket.d.ts +3 -1
- package/lib/chevre/repo/action/checkMovieTicket.js +8 -1
- package/lib/chevre/repo/action/confirm.d.ts +11 -0
- package/lib/chevre/repo/action/confirm.js +16 -0
- package/lib/chevre/repo/action/create.d.ts +10 -0
- package/lib/chevre/repo/action/create.js +17 -0
- package/lib/chevre/repo/action/inform.d.ts +38 -0
- package/lib/chevre/repo/action/inform.js +146 -0
- package/lib/chevre/repo/action/order.d.ts +21 -0
- package/lib/chevre/repo/action/order.js +35 -0
- package/lib/chevre/repo/action/pay.d.ts +3 -1
- package/lib/chevre/repo/action/pay.js +7 -4
- package/lib/chevre/repo/action/refund.d.ts +3 -1
- package/lib/chevre/repo/action/refund.js +7 -4
- package/lib/chevre/repo/action/reserve.d.ts +21 -0
- package/lib/chevre/repo/action/reserve.js +37 -0
- package/lib/chevre/repo/action/returnAction.d.ts +11 -0
- package/lib/chevre/repo/action/returnAction.js +16 -0
- package/lib/chevre/repo/action/sendEmailMessage.d.ts +10 -0
- package/lib/chevre/repo/action/sendEmailMessage.js +17 -0
- package/lib/chevre/repo/action/sendOrder.d.ts +10 -0
- package/lib/chevre/repo/action/sendOrder.js +16 -0
- package/lib/chevre/repo/action/unknown2actionError.d.ts +6 -0
- package/lib/chevre/repo/action/unknown2actionError.js +15 -0
- package/lib/chevre/repo/action/update.d.ts +48 -0
- package/lib/chevre/repo/action/update.js +166 -0
- package/lib/chevre/repo/action/use.d.ts +39 -0
- package/lib/chevre/repo/action/use.js +153 -0
- package/lib/chevre/repo/{action.d.ts → adminAction.d.ts} +11 -37
- package/lib/chevre/repo/adminAction.js +176 -0
- package/lib/chevre/repo/adminAssetTransaction.d.ts +126 -0
- package/lib/chevre/repo/adminAssetTransaction.js +491 -0
- package/lib/chevre/repo/adminScheduledTask.d.ts +1 -1
- package/lib/chevre/repo/adminTask.d.ts +25 -8
- package/lib/chevre/repo/adminTask.js +31 -32
- package/lib/chevre/repo/adminTransaction.d.ts +131 -0
- package/lib/chevre/repo/adminTransaction.js +237 -0
- package/lib/chevre/repo/aggregateAction.d.ts +8 -11
- package/lib/chevre/repo/aggregateAction.js +0 -61
- package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
- package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
- package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
- package/lib/chevre/repo/aggregateTransaction.js +166 -0
- package/lib/chevre/repo/aggregateUseAction.d.ts +35 -0
- package/lib/chevre/repo/aggregateUseAction.js +164 -0
- package/lib/chevre/repo/aggregation.d.ts +0 -8
- package/lib/chevre/repo/aggregation.js +0 -10
- package/lib/chevre/repo/assetTransaction.d.ts +10 -235
- package/lib/chevre/repo/assetTransaction.js +48 -636
- package/lib/chevre/repo/authorization.d.ts +0 -6
- package/lib/chevre/repo/authorization.js +15 -27
- package/lib/chevre/repo/message.d.ts +0 -7
- package/lib/chevre/repo/message.js +0 -38
- package/lib/chevre/repo/migrateAction.d.ts +48 -0
- package/lib/chevre/repo/migrateAction.js +32 -0
- package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +11 -0
- package/lib/chevre/repo/mongoose/schemas/action/inform.js +82 -0
- package/lib/chevre/repo/mongoose/schemas/action/update.d.ts +12 -0
- package/lib/chevre/repo/mongoose/schemas/action/update.js +112 -0
- package/lib/chevre/repo/mongoose/schemas/{ownershipInfo.d.ts → action/use.d.ts} +4 -6
- package/lib/chevre/repo/mongoose/schemas/action/use.js +92 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +22 -7
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +19 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +8 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +95 -76
- package/lib/chevre/repo/mongoose/schemas/authorization.js +25 -18
- package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/message.js +8 -1
- package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +5 -16
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +2 -5
- package/lib/chevre/repo/mongoose/schemas/task.js +134 -118
- package/lib/chevre/repo/mongoose/schemas/ticket.js +8 -1
- package/lib/chevre/repo/orderInTransaction.d.ts +0 -3
- package/lib/chevre/repo/orderInTransaction.js +30 -22
- package/lib/chevre/repo/scheduledTask.d.ts +4 -1
- package/lib/chevre/repo/scheduledTask.js +3 -25
- package/lib/chevre/repo/task.d.ts +44 -155
- package/lib/chevre/repo/task.js +13 -555
- package/lib/chevre/repo/taskDelayed.d.ts +74 -0
- package/lib/chevre/repo/taskDelayed.js +195 -0
- package/lib/chevre/repo/taskRunning.d.ts +35 -0
- package/lib/chevre/repo/taskRunning.js +89 -0
- package/lib/chevre/repo/ticket.d.ts +0 -6
- package/lib/chevre/repo/ticket.js +0 -11
- package/lib/chevre/repo/transaction.d.ts +1 -187
- package/lib/chevre/repo/transaction.js +2 -383
- package/lib/chevre/repository.d.ts +65 -25
- package/lib/chevre/repository.js +144 -56
- package/lib/chevre/service/aggregation/system.d.ts +9 -8
- package/lib/chevre/service/aggregation/system.js +5 -5
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
- package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/refund.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +8 -4
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -1
- package/lib/chevre/service/asyncAction.d.ts +2 -2
- package/lib/chevre/service/asyncAction.js +1 -4
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +2 -2
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +0 -2
- package/lib/chevre/service/asyncActionHandler.d.ts +4 -4
- package/lib/chevre/service/asyncActionHandler.js +11 -13
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +4 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
- package/lib/chevre/service/event.d.ts +4 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/notification/sendEmailMessage.d.ts +4 -2
- package/lib/chevre/service/notification/sendEmailMessage.js +3 -3
- package/lib/chevre/service/notification/triggerWebhook.d.ts +4 -2
- package/lib/chevre/service/notification/triggerWebhook.js +5 -16
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +0 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +4 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +9 -5
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +6 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -9
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +6 -4
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -15
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +0 -4
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +19 -19
- package/lib/chevre/service/offer/onEventChanged.js +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +4 -10
- package/lib/chevre/service/order/confirmPayTransaction.js +7 -11
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +2 -56
- package/lib/chevre/service/order/deleteOrder.d.ts +2 -2
- package/lib/chevre/service/order/deleteOrder.js +1 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +1 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +4 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -11
- package/lib/chevre/service/order/onOrderUpdated/factory.js +0 -3
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +4 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +6 -4
- package/lib/chevre/service/order/placeOrder.js +9 -17
- package/lib/chevre/service/order/returnOrder.d.ts +4 -4
- package/lib/chevre/service/order/returnOrder.js +11 -43
- package/lib/chevre/service/order/sendOrder.d.ts +4 -6
- package/lib/chevre/service/order/sendOrder.js +30 -72
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +0 -1
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +0 -1
- package/lib/chevre/service/payment/any/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findAcceptAction.js +19 -19
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +19 -19
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findCheckAction.js +19 -19
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +0 -1
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +0 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +0 -1
- package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +0 -1
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -2
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +0 -1
- package/lib/chevre/service/project.d.ts +0 -6
- package/lib/chevre/service/project.js +0 -2
- package/lib/chevre/service/reserve/cancelReservation.d.ts +7 -3
- package/lib/chevre/service/reserve/cancelReservation.js +15 -25
- package/lib/chevre/service/reserve/checkInReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/confirmReservation.js +10 -36
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -1
- package/lib/chevre/service/reserve/useReservation.d.ts +6 -2
- package/lib/chevre/service/reserve/useReservation.js +6 -24
- package/lib/chevre/service/reserveCOA/cancelReservation.d.ts +4 -2
- package/lib/chevre/service/reserveCOA/cancelReservation.js +3 -3
- package/lib/chevre/service/scheduledTask.d.ts +1 -4
- package/lib/chevre/service/scheduledTask.js +3 -10
- package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +1 -2
- package/lib/chevre/service/scheduledTaskHandler.js +0 -13
- package/lib/chevre/service/task/acceptCOAOffer.js +1 -14
- package/lib/chevre/service/task/authorizePayment.js +1 -7
- package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
- package/lib/chevre/service/task/cancelReservation.js +3 -5
- package/lib/chevre/service/task/checkMovieTicket.js +1 -7
- package/lib/chevre/service/task/checkResource.js +14 -57
- package/lib/chevre/service/task/confirmPayTransaction.js +11 -12
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +12 -7
- package/lib/chevre/service/task/createAccountingReport.js +8 -15
- package/lib/chevre/service/task/deleteTransaction.js +10 -41
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
- package/lib/chevre/service/task/invalidatePaymentUrl.js +0 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +4 -13
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted.js +4 -3
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated.js +0 -10
- package/lib/chevre/service/task/pay.js +0 -1
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/payByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/refundByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +0 -2
- package/lib/chevre/service/task/placeOrder.js +8 -6
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -13
- package/lib/chevre/service/task/refund.js +0 -1
- package/lib/chevre/service/task/reserve.js +3 -6
- package/lib/chevre/service/task/returnOrder.js +3 -7
- package/lib/chevre/service/task/returnPayTransaction.js +9 -19
- package/lib/chevre/service/task/returnReserveTransaction.js +5 -6
- package/lib/chevre/service/task/sendEmailMessage.js +2 -2
- package/lib/chevre/service/task/sendOrder.js +4 -8
- package/lib/chevre/service/task/syncResourcesFromCOA.js +31 -23
- package/lib/chevre/service/task/triggerWebhook.js +4 -2
- package/lib/chevre/service/task/useReservation.js +6 -2
- package/lib/chevre/service/task/voidPayment.js +0 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +11 -13
- package/lib/chevre/service/task.d.ts +4 -4
- package/lib/chevre/service/task.js +8 -12
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +0 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +3 -2
- package/lib/chevre/service/taskHandler/onOperationFailed.js +5 -16
- package/lib/chevre/service/taskHandler.d.ts +1 -2
- package/lib/chevre/service/taskHandler.js +7 -19
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +8 -4
- package/lib/chevre/service/transaction/deleteTransaction.js +7 -7
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +11 -17
- package/lib/chevre/service/transaction/returnOrder.js +11 -17
- package/lib/chevre/service/validation/validateOrder.d.ts +0 -4
- package/lib/chevre/service/validation/validateOrder.js +3 -3
- package/lib/chevre/taskSettings.d.ts +4 -4
- package/package.json +2 -2
- package/lib/chevre/repo/action/actionProcess.d.ts +0 -147
- package/lib/chevre/repo/action/checkThing.d.ts +0 -8
- package/lib/chevre/repo/action/checkThing.js +0 -13
- package/lib/chevre/repo/action.js +0 -468
- package/lib/chevre/repo/asyncActionLegacy.d.ts +0 -23
- package/lib/chevre/repo/asyncActionLegacy.js +0 -59
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -227
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.d.ts +0 -25
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.js +0 -100
- package/lib/chevre/repo/ownershipInfo.d.ts +0 -122
- package/lib/chevre/repo/ownershipInfo.js +0 -466
- package/lib/chevre/repo/scheduledTaskLegacy.d.ts +0 -39
- package/lib/chevre/repo/scheduledTaskLegacy.js +0 -96
- package/lib/chevre/repo/scheduledTaskMigration.d.ts +0 -21
- package/lib/chevre/repo/scheduledTaskMigration.js +0 -70
- package/lib/chevre/service/validation/validateEvent.d.ts +0 -11
- package/lib/chevre/service/validation/validateEvent.js +0 -21
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminAssetTransactionRepo = void 0;
|
|
4
|
+
const assetTransaction_1 = require("./mongoose/schemas/assetTransaction");
|
|
5
|
+
const factory_1 = require("../factory");
|
|
6
|
+
const assetTransaction_2 = require("../eventEmitter/assetTransaction");
|
|
7
|
+
const settings_1 = require("../settings");
|
|
8
|
+
/**
|
|
9
|
+
* 資産取引管理リポジトリ
|
|
10
|
+
*/
|
|
11
|
+
class AdminAssetTransactionRepo {
|
|
12
|
+
transactionModel;
|
|
13
|
+
constructor(connection) {
|
|
14
|
+
this.transactionModel = connection.model(assetTransaction_1.modelName, (0, assetTransaction_1.createSchema)());
|
|
15
|
+
}
|
|
16
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
17
|
+
const andConditions = [
|
|
18
|
+
{ typeOf: { $eq: params.typeOf } }
|
|
19
|
+
];
|
|
20
|
+
const projectIdEq = params.project?.id?.$eq;
|
|
21
|
+
/* istanbul ignore else */
|
|
22
|
+
if (typeof projectIdEq === 'string') {
|
|
23
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
24
|
+
}
|
|
25
|
+
/* istanbul ignore else */
|
|
26
|
+
if (params.startFrom !== undefined) {
|
|
27
|
+
andConditions.push({
|
|
28
|
+
startDate: { $gte: params.startFrom }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/* istanbul ignore else */
|
|
32
|
+
if (params.startThrough !== undefined) {
|
|
33
|
+
andConditions.push({
|
|
34
|
+
startDate: { $lte: params.startThrough }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/* istanbul ignore else */
|
|
38
|
+
if (params.endFrom !== undefined) {
|
|
39
|
+
andConditions.push({
|
|
40
|
+
endDate: {
|
|
41
|
+
$exists: true,
|
|
42
|
+
$gte: params.endFrom
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/* istanbul ignore else */
|
|
47
|
+
if (params.endThrough !== undefined) {
|
|
48
|
+
andConditions.push({
|
|
49
|
+
endDate: {
|
|
50
|
+
$exists: true,
|
|
51
|
+
$lt: params.endThrough
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/* istanbul ignore else */
|
|
56
|
+
if (Array.isArray(params.ids)) {
|
|
57
|
+
andConditions.push({
|
|
58
|
+
_id: { $in: params.ids }
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/* istanbul ignore else */
|
|
62
|
+
if (Array.isArray(params.statuses)) {
|
|
63
|
+
andConditions.push({ status: { $in: params.statuses } });
|
|
64
|
+
}
|
|
65
|
+
/* istanbul ignore else */
|
|
66
|
+
const statusIn = params.status?.$in;
|
|
67
|
+
if (Array.isArray(statusIn)) {
|
|
68
|
+
andConditions.push({ status: { $in: statusIn } });
|
|
69
|
+
}
|
|
70
|
+
/* istanbul ignore else */
|
|
71
|
+
if (params.agent !== undefined) {
|
|
72
|
+
if (Array.isArray(params.agent.ids)) {
|
|
73
|
+
andConditions.push({
|
|
74
|
+
'agent.id': { $in: params.agent.ids }
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const transactionNumberEq = params.transactionNumber?.$eq;
|
|
79
|
+
if (typeof transactionNumberEq === 'string') {
|
|
80
|
+
andConditions.push({ transactionNumber: { $eq: transactionNumberEq } });
|
|
81
|
+
}
|
|
82
|
+
const transactionNumberIn = params.transactionNumber?.$in;
|
|
83
|
+
if (Array.isArray(transactionNumberIn)) {
|
|
84
|
+
andConditions.push({ transactionNumber: { $in: transactionNumberIn } });
|
|
85
|
+
}
|
|
86
|
+
const tasksExportActionStatusIn = params.tasksExportAction?.actionStatus?.$in;
|
|
87
|
+
/* istanbul ignore else */
|
|
88
|
+
if (Array.isArray(tasksExportActionStatusIn)) {
|
|
89
|
+
andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $in: tasksExportActionStatusIn } });
|
|
90
|
+
}
|
|
91
|
+
const tasksExportActionStatusEq = params.tasksExportAction?.actionStatus?.$eq;
|
|
92
|
+
/* istanbul ignore else */
|
|
93
|
+
if (typeof tasksExportActionStatusEq === 'string') {
|
|
94
|
+
andConditions.push({ 'tasksExportAction.actionStatus': { $exists: true, $eq: tasksExportActionStatusEq } });
|
|
95
|
+
}
|
|
96
|
+
switch (params.typeOf) {
|
|
97
|
+
case factory_1.factory.assetTransactionType.Pay: {
|
|
98
|
+
const objectAccountIdEq = params.object?.accountId?.$eq;
|
|
99
|
+
if (typeof objectAccountIdEq === 'string') {
|
|
100
|
+
andConditions.push({ 'object.accountId': { $exists: true, $eq: objectAccountIdEq } });
|
|
101
|
+
}
|
|
102
|
+
const objectTypeOfEq = params.object?.typeOf?.$eq;
|
|
103
|
+
if (typeof objectTypeOfEq === 'string') {
|
|
104
|
+
andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case factory_1.factory.assetTransactionType.Refund: {
|
|
109
|
+
const objectAccountIdEq4refund = params.object?.accountId?.$eq;
|
|
110
|
+
if (typeof objectAccountIdEq4refund === 'string') {
|
|
111
|
+
andConditions.push({
|
|
112
|
+
'object.accountId': {
|
|
113
|
+
$exists: true,
|
|
114
|
+
$eq: objectAccountIdEq4refund
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const objectPaymentMethodIdEq4refund = params.object?.paymentMethodId?.$eq;
|
|
119
|
+
if (typeof objectPaymentMethodIdEq4refund === 'string') {
|
|
120
|
+
andConditions.push({
|
|
121
|
+
'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq4refund }
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const objectPaymentMethodIdIn4refund = params.object?.paymentMethodId?.$in;
|
|
125
|
+
if (Array.isArray(objectPaymentMethodIdIn4refund)) {
|
|
126
|
+
andConditions.push({
|
|
127
|
+
'object.paymentMethodId': { $exists: true, $in: objectPaymentMethodIdIn4refund }
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case factory_1.factory.assetTransactionType.CancelReservation: {
|
|
133
|
+
const objectReservationNumberIn4cancelReservation = params.object?.reservationNumber?.$in;
|
|
134
|
+
if (Array.isArray(objectReservationNumberIn4cancelReservation)) {
|
|
135
|
+
andConditions.push({
|
|
136
|
+
'object.reservationNumber': { $exists: true, $in: objectReservationNumberIn4cancelReservation }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const objectReservationNumberEq4cancelReservation = params.object?.reservationNumber?.$eq;
|
|
140
|
+
if (typeof objectReservationNumberEq4cancelReservation === 'string') {
|
|
141
|
+
andConditions.push({
|
|
142
|
+
'object.reservationNumber': { $exists: true, $eq: objectReservationNumberEq4cancelReservation }
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case factory_1.factory.assetTransactionType.Reserve: {
|
|
148
|
+
// discontinue(2026-08-10~)
|
|
149
|
+
// const objectProviderIdEq = params.object?.provider?.id?.$eq;
|
|
150
|
+
// if (typeof objectProviderIdEq === 'string') {
|
|
151
|
+
// andConditions.push({ 'object.provider.id': { $exists: true, $eq: objectProviderIdEq } });
|
|
152
|
+
// }
|
|
153
|
+
const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
|
|
154
|
+
if (typeof objectReservationForIdEq === 'string') {
|
|
155
|
+
andConditions.push({
|
|
156
|
+
'object.reservationFor.id': {
|
|
157
|
+
$exists: true,
|
|
158
|
+
$eq: objectReservationForIdEq
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const objectReservationNumberIn = params.object?.reservationNumber?.$in;
|
|
163
|
+
if (Array.isArray(objectReservationNumberIn)) {
|
|
164
|
+
andConditions.push({
|
|
165
|
+
'object.reservationNumber': { $exists: true, $in: objectReservationNumberIn }
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
|
|
169
|
+
if (typeof objectReservationNumberEq === 'string') {
|
|
170
|
+
andConditions.push({
|
|
171
|
+
'object.reservationNumber': { $exists: true, $eq: objectReservationNumberEq }
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const objectSubReservationIdIn = params.object?.reservations?.id?.$in;
|
|
175
|
+
if (Array.isArray(objectSubReservationIdIn)) {
|
|
176
|
+
andConditions.push({
|
|
177
|
+
'object.subReservation.id': {
|
|
178
|
+
$exists: true,
|
|
179
|
+
$in: objectSubReservationIdIn
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (params.object !== undefined) {
|
|
184
|
+
if (params.object.reservations !== undefined) {
|
|
185
|
+
// discontinue(2026-08-10~)
|
|
186
|
+
// if (params.object.reservations.reservationNumber !== undefined) {
|
|
187
|
+
// if (Array.isArray(params.object.reservations.reservationNumber.$in)) {
|
|
188
|
+
// andConditions.push({
|
|
189
|
+
// 'object.subReservation.reservationNumber': {
|
|
190
|
+
// $exists: true,
|
|
191
|
+
// $in: params.object.reservations.reservationNumber.$in
|
|
192
|
+
// }
|
|
193
|
+
// });
|
|
194
|
+
// }
|
|
195
|
+
// }
|
|
196
|
+
// discontinue(2026-08-10~)
|
|
197
|
+
// if (params.object.reservations.reservationFor !== undefined) {
|
|
198
|
+
// if (params.object.reservations.reservationFor.id !== undefined) {
|
|
199
|
+
// if (Array.isArray(params.object.reservations.reservationFor.id.$in)) {
|
|
200
|
+
// andConditions.push({
|
|
201
|
+
// 'object.subReservation.reservationFor.id': {
|
|
202
|
+
// $exists: true,
|
|
203
|
+
// $in: params.object.reservations.reservationFor.id.$in
|
|
204
|
+
// }
|
|
205
|
+
// });
|
|
206
|
+
// }
|
|
207
|
+
// }
|
|
208
|
+
// }
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// discontinue(2026-08-10~)
|
|
212
|
+
// const objectUnderNameIdEq = params.object?.underName?.id?.$eq;
|
|
213
|
+
// if (typeof objectUnderNameIdEq === 'string') {
|
|
214
|
+
// andConditions.push({
|
|
215
|
+
// 'object.underName.id': {
|
|
216
|
+
// $exists: true,
|
|
217
|
+
// $eq: objectUnderNameIdEq
|
|
218
|
+
// }
|
|
219
|
+
// });
|
|
220
|
+
// }
|
|
221
|
+
const objectSubReservationSeatNumberEq = params.object?.reservations?.reservedTicket?.ticketedSeat?.seatNumber?.$eq;
|
|
222
|
+
if (typeof objectSubReservationSeatNumberEq === 'string') {
|
|
223
|
+
andConditions.push({
|
|
224
|
+
'object.subReservation.reservedTicket.ticketedSeat.seatNumber': {
|
|
225
|
+
$exists: true,
|
|
226
|
+
$eq: objectSubReservationSeatNumberEq
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
default:
|
|
233
|
+
}
|
|
234
|
+
return andConditions;
|
|
235
|
+
}
|
|
236
|
+
async countPotentiallyExportTasks(params) {
|
|
237
|
+
const { endDate, limit } = params;
|
|
238
|
+
const endDateLt = endDate?.$lt;
|
|
239
|
+
if (!(endDateLt instanceof Date)) {
|
|
240
|
+
throw new factory_1.factory.errors.Argument('endDate.$lt', 'must be Date');
|
|
241
|
+
}
|
|
242
|
+
const query = this.transactionModel.countDocuments({
|
|
243
|
+
status: {
|
|
244
|
+
$in: [
|
|
245
|
+
factory_1.factory.transactionStatusType.Canceled,
|
|
246
|
+
factory_1.factory.transactionStatusType.Confirmed,
|
|
247
|
+
factory_1.factory.transactionStatusType.Expired
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
'tasksExportAction.actionStatus': {
|
|
251
|
+
$exists: true,
|
|
252
|
+
$eq: factory_1.factory.actionStatusType.PotentialActionStatus
|
|
253
|
+
},
|
|
254
|
+
endDate: { $exists: true, $lt: endDateLt }
|
|
255
|
+
});
|
|
256
|
+
if (typeof limit === 'number' && limit >= 0) {
|
|
257
|
+
query.limit(limit);
|
|
258
|
+
}
|
|
259
|
+
const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
260
|
+
.exec();
|
|
261
|
+
return { count };
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* tasksExportAction.actionStatusがActiveActionStatusのまま一定時間経過した取引について
|
|
265
|
+
* PotentialActionStatusに変更する
|
|
266
|
+
* 2025-03-10~
|
|
267
|
+
*/
|
|
268
|
+
async reExportAction(params) {
|
|
269
|
+
const { startDate } = params;
|
|
270
|
+
if (!(startDate.$lt instanceof Date)) {
|
|
271
|
+
throw new factory_1.factory.errors.Argument('startDate.$lt', 'must be Date');
|
|
272
|
+
}
|
|
273
|
+
return this.transactionModel.updateMany({
|
|
274
|
+
'tasksExportAction.actionStatus': {
|
|
275
|
+
$exists: true,
|
|
276
|
+
$eq: factory_1.factory.actionStatusType.ActiveActionStatus
|
|
277
|
+
},
|
|
278
|
+
'tasksExportAction.startDate': {
|
|
279
|
+
$exists: true,
|
|
280
|
+
$lt: startDate.$lt
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
$set: {
|
|
284
|
+
tasksExportAction: {
|
|
285
|
+
actionStatus: factory_1.factory.actionStatusType.PotentialActionStatus
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
.exec();
|
|
290
|
+
}
|
|
291
|
+
// /**
|
|
292
|
+
// * タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
|
|
293
|
+
// */
|
|
294
|
+
// public async exportTasksMany(params: {
|
|
295
|
+
// now: Date;
|
|
296
|
+
// delayInSeconds: number;
|
|
297
|
+
// status: {
|
|
298
|
+
// $in: factory.transactionStatusType[];
|
|
299
|
+
// };
|
|
300
|
+
// limit: number;
|
|
301
|
+
// }) {
|
|
302
|
+
// const delayedTransactions = await this.transactionModel.find({
|
|
303
|
+
// status: { $in: params.status.$in },
|
|
304
|
+
// 'tasksExportAction.actionStatus': {
|
|
305
|
+
// $exists: true,
|
|
306
|
+
// $eq: factory.actionStatusType.PotentialActionStatus
|
|
307
|
+
// },
|
|
308
|
+
// endDate: {
|
|
309
|
+
// $exists: true,
|
|
310
|
+
// $lt: moment(params.now)
|
|
311
|
+
// .add(-params.delayInSeconds, 'seconds')
|
|
312
|
+
// .toDate()
|
|
313
|
+
// }
|
|
314
|
+
// })
|
|
315
|
+
// .select({
|
|
316
|
+
// _id: 0,
|
|
317
|
+
// id: { $toString: '$_id' },
|
|
318
|
+
// typeOf: 1,
|
|
319
|
+
// status: 1
|
|
320
|
+
// })
|
|
321
|
+
// .limit(params.limit)
|
|
322
|
+
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
323
|
+
// .lean<Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType>, 'id' | 'status' | 'typeOf'>[]>()
|
|
324
|
+
// .exec();
|
|
325
|
+
// if (delayedTransactions.length > 0) {
|
|
326
|
+
// delayedTransactions.forEach((delayedTransaction) => {
|
|
327
|
+
// assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
328
|
+
// id: delayedTransaction.id,
|
|
329
|
+
// typeOf: delayedTransaction.typeOf,
|
|
330
|
+
// status: delayedTransaction.status
|
|
331
|
+
// });
|
|
332
|
+
// });
|
|
333
|
+
// }
|
|
334
|
+
// return delayedTransactions;
|
|
335
|
+
// }
|
|
336
|
+
/**
|
|
337
|
+
* add(2025-03-17~)
|
|
338
|
+
*/
|
|
339
|
+
async countPotentiallyExpired(params) {
|
|
340
|
+
const { expires, limit } = params;
|
|
341
|
+
const query = this.transactionModel.countDocuments({
|
|
342
|
+
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
343
|
+
expires: { $lt: expires.$lt }
|
|
344
|
+
});
|
|
345
|
+
if (typeof limit === 'number' && limit >= 0) {
|
|
346
|
+
query.limit(limit);
|
|
347
|
+
}
|
|
348
|
+
const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
349
|
+
.exec();
|
|
350
|
+
return { count };
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* add(2025-03-12~)
|
|
354
|
+
*/
|
|
355
|
+
async makeOneExpiredIfExists(params) {
|
|
356
|
+
const endDate = new Date();
|
|
357
|
+
const sort = {
|
|
358
|
+
expires: factory_1.factory.sortType.Ascending
|
|
359
|
+
};
|
|
360
|
+
const doc = await this.transactionModel.findOneAndUpdate({
|
|
361
|
+
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
362
|
+
expires: { $lt: params.expires.$lt }
|
|
363
|
+
}, {
|
|
364
|
+
status: factory_1.factory.transactionStatusType.Expired,
|
|
365
|
+
endDate
|
|
366
|
+
}, {
|
|
367
|
+
new: true,
|
|
368
|
+
projection: {
|
|
369
|
+
_id: 0,
|
|
370
|
+
id: { $toString: '$_id' },
|
|
371
|
+
typeOf: 1
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
.sort(sort)
|
|
375
|
+
.lean()
|
|
376
|
+
.exec();
|
|
377
|
+
if (doc === null) {
|
|
378
|
+
// no op
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
383
|
+
id: doc.id,
|
|
384
|
+
typeOf: doc.typeOf,
|
|
385
|
+
status: factory_1.factory.transactionStatusType.Expired
|
|
386
|
+
});
|
|
387
|
+
return doc;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// /**
|
|
391
|
+
// * 取引を期限切れにする
|
|
392
|
+
// */
|
|
393
|
+
// public async makeExpired(params: {
|
|
394
|
+
// expires: { $lt: Date };
|
|
395
|
+
// }): Promise<void> {
|
|
396
|
+
// // IDをemitしたいのでまずリスト検索(2023-04-27~)
|
|
397
|
+
// const expiringTransactions: Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType>, 'id' | 'typeOf'>[] =
|
|
398
|
+
// await this.transactionModel.find({
|
|
399
|
+
// status: { $eq: factory.transactionStatusType.InProgress },
|
|
400
|
+
// expires: { $lt: params.expires.$lt }
|
|
401
|
+
// })
|
|
402
|
+
// .select({
|
|
403
|
+
// _id: 1,
|
|
404
|
+
// typeOf: 1
|
|
405
|
+
// })
|
|
406
|
+
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
407
|
+
// .exec();
|
|
408
|
+
// if (expiringTransactions.length > 0) {
|
|
409
|
+
// // ステータスと期限を見て更新
|
|
410
|
+
// await this.transactionModel.updateMany(
|
|
411
|
+
// {
|
|
412
|
+
// _id: { $in: expiringTransactions.map((t) => t.id) },
|
|
413
|
+
// status: { $eq: factory.transactionStatusType.InProgress },
|
|
414
|
+
// expires: { $lt: params.expires.$lt }
|
|
415
|
+
// },
|
|
416
|
+
// {
|
|
417
|
+
// status: factory.transactionStatusType.Expired,
|
|
418
|
+
// endDate: new Date()
|
|
419
|
+
// }
|
|
420
|
+
// )
|
|
421
|
+
// .exec();
|
|
422
|
+
// expiringTransactions.forEach((expiringTransaction) => {
|
|
423
|
+
// assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
424
|
+
// id: expiringTransaction.id,
|
|
425
|
+
// typeOf: expiringTransaction.typeOf,
|
|
426
|
+
// status: factory.transactionStatusType.Expired
|
|
427
|
+
// });
|
|
428
|
+
// });
|
|
429
|
+
// }
|
|
430
|
+
// }
|
|
431
|
+
async countAssetTransactions(params) {
|
|
432
|
+
const { limit } = params;
|
|
433
|
+
const conditions = AdminAssetTransactionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
434
|
+
const query = this.transactionModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {});
|
|
435
|
+
if (typeof limit === 'number' && limit >= 0) {
|
|
436
|
+
query.limit(limit);
|
|
437
|
+
}
|
|
438
|
+
const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
439
|
+
.exec();
|
|
440
|
+
return { count };
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* 取引を検索する
|
|
444
|
+
*/
|
|
445
|
+
async findAssetTransactions(params, inclusion, exclusion) {
|
|
446
|
+
const conditions = AdminAssetTransactionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
447
|
+
let projection = {};
|
|
448
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
449
|
+
inclusion.forEach((field) => {
|
|
450
|
+
projection[field] = 1;
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
projection = {
|
|
455
|
+
__v: 0,
|
|
456
|
+
createdAt: 0,
|
|
457
|
+
updatedAt: 0
|
|
458
|
+
};
|
|
459
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
460
|
+
exclusion.forEach((field) => {
|
|
461
|
+
projection[field] = 0;
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
466
|
+
.select(projection);
|
|
467
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
468
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
469
|
+
query.limit(params.limit)
|
|
470
|
+
.skip(params.limit * (page - 1));
|
|
471
|
+
}
|
|
472
|
+
/* istanbul ignore else */
|
|
473
|
+
if (params.sort?.startDate !== undefined) {
|
|
474
|
+
query.sort({ startDate: params.sort.startDate });
|
|
475
|
+
}
|
|
476
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
477
|
+
.exec()
|
|
478
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
479
|
+
}
|
|
480
|
+
getCursor(conditions, projection) {
|
|
481
|
+
return this.transactionModel.find(conditions, projection)
|
|
482
|
+
// .sort({ startDate: factory.sortType.Ascending })
|
|
483
|
+
.sort({ startDate: factory_1.factory.sortType.Descending })
|
|
484
|
+
.cursor();
|
|
485
|
+
}
|
|
486
|
+
async unsetUnnecessaryFields(params) {
|
|
487
|
+
return this.transactionModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
488
|
+
.exec();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
exports.AdminAssetTransactionRepo = AdminAssetTransactionRepo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IDocType } from './mongoose/schemas/scheduledTasks';
|
|
4
|
-
type IKeyOfProjection = keyof
|
|
4
|
+
type IKeyOfProjection = keyof IDocType;
|
|
5
5
|
type IFindParams = Pick<factory.task.ISearchConditions, 'id' | 'name' | 'project' | 'runsFrom' | 'runsThrough' | 'status' | 'limit' | 'page' | 'sort'>;
|
|
6
6
|
/**
|
|
7
7
|
* 予定タスク管理リポジトリ
|
|
@@ -1,29 +1,46 @@
|
|
|
1
1
|
import type { AnyKeys, Connection, FilterQuery, ProjectionType } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IDocType } from './mongoose/schemas/task';
|
|
4
|
-
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName
|
|
4
|
+
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName>;
|
|
5
|
+
type IFindParams = factory.task.ISearchConditions & {
|
|
6
|
+
data?: never;
|
|
7
|
+
lastTriedFrom?: never;
|
|
8
|
+
lastTriedThrough?: never;
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
11
|
* タスク管理リポジトリ
|
|
7
12
|
*/
|
|
8
13
|
export declare class AdminTaskRepo {
|
|
9
14
|
private readonly taskModel;
|
|
10
15
|
constructor(connection: Connection);
|
|
11
|
-
static CREATE_MONGO_CONDITIONS(params:
|
|
12
|
-
countTasks(params:
|
|
16
|
+
static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask>[];
|
|
17
|
+
countTasks(params: IFindParams): Promise<{
|
|
13
18
|
count: number;
|
|
14
19
|
}>;
|
|
15
20
|
/**
|
|
16
21
|
* 検索する
|
|
17
22
|
*/
|
|
18
|
-
findTasks(params:
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
findTasks(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<factory.task.ITask<factory.taskName>[]>;
|
|
24
|
+
/**
|
|
25
|
+
* cron:notifyLatency専用
|
|
26
|
+
*/
|
|
27
|
+
countDelayedTasks(params: {
|
|
28
|
+
delayInSeconds: number;
|
|
29
|
+
name: {
|
|
30
|
+
$nin?: factory.taskName[];
|
|
31
|
+
};
|
|
32
|
+
limit?: number;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
count: number;
|
|
35
|
+
}>;
|
|
36
|
+
getCursor(conditions: FilterQuery<factory.task.ITask<factory.taskName>>, projection: ProjectionType<factory.task.ITask<factory.taskName>>): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Pick<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask, "name" | "description" | "project" | "identifier" | "data" | "status" | "runsAt" | "dateAborted" | "executionResults" | "executor" | "lastTriedAt" | "remainingNumberOfTries" | "numberOfTried"> & {
|
|
37
|
+
expires?: never;
|
|
21
38
|
} & {
|
|
22
39
|
_id: import("mongoose").Types.ObjectId;
|
|
23
40
|
} & {
|
|
24
41
|
__v: number;
|
|
25
|
-
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> &
|
|
26
|
-
expires?:
|
|
42
|
+
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Pick<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask, "name" | "description" | "project" | "identifier" | "data" | "status" | "runsAt" | "dateAborted" | "executionResults" | "executor" | "lastTriedAt" | "remainingNumberOfTries" | "numberOfTried"> & {
|
|
43
|
+
expires?: never;
|
|
27
44
|
} & {
|
|
28
45
|
_id: import("mongoose").Types.ObjectId;
|
|
29
46
|
} & {
|