@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,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateAssetTransactionRepo = void 0;
|
|
4
|
+
const assetTransaction_1 = require("./mongoose/schemas/assetTransaction");
|
|
5
|
+
const factory_1 = require("../factory");
|
|
6
|
+
/**
|
|
7
|
+
* 資産取引集計リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class AggregateAssetTransactionRepo {
|
|
10
|
+
transactionModel;
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
this.transactionModel = connection.model(assetTransaction_1.modelName, (0, assetTransaction_1.createSchema)());
|
|
13
|
+
}
|
|
14
|
+
async aggregateAssetTransaction(params) {
|
|
15
|
+
const statuses = await Promise.all([
|
|
16
|
+
factory_1.factory.transactionStatusType.Confirmed,
|
|
17
|
+
factory_1.factory.transactionStatusType.Canceled,
|
|
18
|
+
factory_1.factory.transactionStatusType.Expired
|
|
19
|
+
].map(async (transactionStatus) => {
|
|
20
|
+
const matchConditions = {
|
|
21
|
+
startDate: {
|
|
22
|
+
$gte: params.startFrom,
|
|
23
|
+
$lte: params.startThrough
|
|
24
|
+
},
|
|
25
|
+
typeOf: { $eq: params.typeOf },
|
|
26
|
+
status: { $eq: transactionStatus },
|
|
27
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
28
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
29
|
+
: undefined,
|
|
30
|
+
...(typeof params.project?.id?.$eq === 'string')
|
|
31
|
+
? { 'project.id': { $eq: params.project.id.$eq } }
|
|
32
|
+
: undefined
|
|
33
|
+
};
|
|
34
|
+
return this.agggregateByStatus({ matchConditions, status: transactionStatus });
|
|
35
|
+
}));
|
|
36
|
+
return { statuses };
|
|
37
|
+
}
|
|
38
|
+
async agggregateByStatus(params) {
|
|
39
|
+
const matchConditions = params.matchConditions;
|
|
40
|
+
const transactionStatus = params.status;
|
|
41
|
+
const aggregations = await this.transactionModel.aggregate([
|
|
42
|
+
{
|
|
43
|
+
$match: matchConditions
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
$project: {
|
|
47
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
48
|
+
graceTime: {
|
|
49
|
+
$cond: {
|
|
50
|
+
if: { $eq: ['$typeOf', factory_1.factory.assetTransactionType.Reserve] },
|
|
51
|
+
then: { $subtract: ['$object.reservationFor.startDate', '$startDate'] },
|
|
52
|
+
else: 0
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
status: '$status',
|
|
56
|
+
startDate: '$startDate',
|
|
57
|
+
endDate: '$endDate',
|
|
58
|
+
typeOf: '$typeOf',
|
|
59
|
+
reservationCount: {
|
|
60
|
+
$cond: {
|
|
61
|
+
if: { $isArray: '$object.subReservation' },
|
|
62
|
+
then: { $size: '$object.subReservation' },
|
|
63
|
+
else: 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
$group: {
|
|
70
|
+
_id: '$typeOf',
|
|
71
|
+
transactionCount: { $sum: 1 },
|
|
72
|
+
maxDuration: { $max: '$duration' },
|
|
73
|
+
minDuration: { $min: '$duration' },
|
|
74
|
+
avgDuration: { $avg: '$duration' },
|
|
75
|
+
reservationCount: { $sum: '$reservationCount' },
|
|
76
|
+
maxGraceTime: { $max: '$graceTime' },
|
|
77
|
+
minGraceTime: { $min: '$graceTime' },
|
|
78
|
+
avgGraceTime: { $avg: '$graceTime' }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
$project: {
|
|
83
|
+
_id: 0,
|
|
84
|
+
transactionCount: '$transactionCount',
|
|
85
|
+
avgDuration: '$avgDuration',
|
|
86
|
+
maxDuration: '$maxDuration',
|
|
87
|
+
minDuration: '$minDuration',
|
|
88
|
+
reservationCount: '$reservationCount',
|
|
89
|
+
avgGraceTime: '$avgGraceTime',
|
|
90
|
+
maxGraceTime: '$maxGraceTime',
|
|
91
|
+
minGraceTime: '$minGraceTime'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
])
|
|
95
|
+
.exec();
|
|
96
|
+
const percents = [50, 95, 99];
|
|
97
|
+
if (aggregations.length === 0) {
|
|
98
|
+
return {
|
|
99
|
+
status: transactionStatus,
|
|
100
|
+
aggregation: {
|
|
101
|
+
transactionCount: 0,
|
|
102
|
+
avgDuration: 0,
|
|
103
|
+
maxDuration: 0,
|
|
104
|
+
minDuration: 0,
|
|
105
|
+
percentilesDuration: percents.map((percent) => {
|
|
106
|
+
return {
|
|
107
|
+
name: String(percent),
|
|
108
|
+
value: 0
|
|
109
|
+
};
|
|
110
|
+
}),
|
|
111
|
+
reservationCount: 0,
|
|
112
|
+
avgGraceTime: 0,
|
|
113
|
+
maxGraceTime: 0,
|
|
114
|
+
minGraceTime: 0
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const ranks4percentile = percents.map((percentile) => {
|
|
119
|
+
return {
|
|
120
|
+
percentile,
|
|
121
|
+
rank: Math.floor(aggregations[0].transactionCount * percentile / 100)
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
const aggregations2 = await this.transactionModel.aggregate([
|
|
125
|
+
{
|
|
126
|
+
$match: matchConditions
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
$project: {
|
|
130
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
131
|
+
status: '$status',
|
|
132
|
+
startDate: '$startDate',
|
|
133
|
+
endDate: '$endDate',
|
|
134
|
+
typeOf: '$typeOf'
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{ $sort: { duration: 1 } },
|
|
138
|
+
{
|
|
139
|
+
$group: {
|
|
140
|
+
_id: '$typeOf',
|
|
141
|
+
durations: { $push: '$duration' }
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
$project: {
|
|
146
|
+
_id: 0,
|
|
147
|
+
percentilesDuration: ranks4percentile.map((rank) => {
|
|
148
|
+
return {
|
|
149
|
+
name: String(rank.percentile),
|
|
150
|
+
value: { $arrayElemAt: ['$durations', rank.rank] }
|
|
151
|
+
};
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
])
|
|
156
|
+
.exec();
|
|
157
|
+
return {
|
|
158
|
+
status: transactionStatus,
|
|
159
|
+
aggregation: {
|
|
160
|
+
...aggregations[0],
|
|
161
|
+
...aggregations2[0]
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.AggregateAssetTransactionRepo = AggregateAssetTransactionRepo;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../factory';
|
|
3
|
+
interface IAggregationByStatus {
|
|
4
|
+
transactionCount: number;
|
|
5
|
+
avgDuration: number;
|
|
6
|
+
maxDuration: number;
|
|
7
|
+
minDuration: number;
|
|
8
|
+
percentilesDuration: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: number;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
interface IStatus {
|
|
14
|
+
status: factory.transactionStatusType;
|
|
15
|
+
aggregation: IAggregationByStatus;
|
|
16
|
+
}
|
|
17
|
+
export interface IAggregatePlaceOrder {
|
|
18
|
+
statuses: IStatus[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 取引集計リポジトリ
|
|
22
|
+
*/
|
|
23
|
+
export declare class AggregateTransactionRepo {
|
|
24
|
+
private readonly transactionModel;
|
|
25
|
+
constructor(connection: Connection);
|
|
26
|
+
aggregatePlaceOrder(params: {
|
|
27
|
+
project?: {
|
|
28
|
+
id?: {
|
|
29
|
+
$ne?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
startFrom: Date;
|
|
33
|
+
startThrough: Date;
|
|
34
|
+
typeOf: factory.transactionType;
|
|
35
|
+
clientId?: string;
|
|
36
|
+
}): Promise<IAggregatePlaceOrder>;
|
|
37
|
+
private agggregateByStatus;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateTransactionRepo = void 0;
|
|
4
|
+
const factory_1 = require("../factory");
|
|
5
|
+
const transaction_1 = require("./mongoose/schemas/transaction");
|
|
6
|
+
/**
|
|
7
|
+
* 取引集計リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class AggregateTransactionRepo {
|
|
10
|
+
transactionModel;
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
this.transactionModel = connection.model(transaction_1.modelName, (0, transaction_1.createSchema)());
|
|
13
|
+
}
|
|
14
|
+
async aggregatePlaceOrder(params) {
|
|
15
|
+
const statuses = await Promise.all([
|
|
16
|
+
factory_1.factory.transactionStatusType.Confirmed,
|
|
17
|
+
factory_1.factory.transactionStatusType.Canceled,
|
|
18
|
+
factory_1.factory.transactionStatusType.Expired
|
|
19
|
+
].map(async (transactionStatus) => {
|
|
20
|
+
const matchConditions = {
|
|
21
|
+
startDate: {
|
|
22
|
+
$gte: params.startFrom,
|
|
23
|
+
$lte: params.startThrough
|
|
24
|
+
},
|
|
25
|
+
typeOf: { $eq: params.typeOf },
|
|
26
|
+
status: { $eq: transactionStatus },
|
|
27
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
28
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
29
|
+
: undefined,
|
|
30
|
+
...(typeof params.clientId === 'string')
|
|
31
|
+
// customerIdentifierAll.push();
|
|
32
|
+
? {
|
|
33
|
+
'agent.identifier': {
|
|
34
|
+
$exists: true,
|
|
35
|
+
$all: [{ name: 'clientId', value: params.clientId }]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
: undefined
|
|
39
|
+
};
|
|
40
|
+
return this.agggregateByStatus({ matchConditions, status: transactionStatus });
|
|
41
|
+
}));
|
|
42
|
+
return { statuses };
|
|
43
|
+
}
|
|
44
|
+
async agggregateByStatus(params) {
|
|
45
|
+
const matchConditions = params.matchConditions;
|
|
46
|
+
const transactionStatus = params.status;
|
|
47
|
+
const aggregations = await this.transactionModel.aggregate([
|
|
48
|
+
{
|
|
49
|
+
$match: matchConditions
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
$project: {
|
|
53
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
54
|
+
status: '$status',
|
|
55
|
+
startDate: '$startDate',
|
|
56
|
+
endDate: '$endDate',
|
|
57
|
+
typeOf: '$typeOf'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
$group: {
|
|
62
|
+
_id: '$typeOf',
|
|
63
|
+
transactionCount: { $sum: 1 },
|
|
64
|
+
maxDuration: { $max: '$duration' },
|
|
65
|
+
minDuration: { $min: '$duration' },
|
|
66
|
+
avgDuration: { $avg: '$duration' }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
$project: {
|
|
71
|
+
_id: 0,
|
|
72
|
+
transactionCount: '$transactionCount',
|
|
73
|
+
avgDuration: '$avgDuration',
|
|
74
|
+
maxDuration: '$maxDuration',
|
|
75
|
+
minDuration: '$minDuration'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
])
|
|
79
|
+
.exec();
|
|
80
|
+
const percents = [50, 95, 99];
|
|
81
|
+
if (aggregations.length === 0) {
|
|
82
|
+
return {
|
|
83
|
+
status: transactionStatus,
|
|
84
|
+
aggregation: {
|
|
85
|
+
transactionCount: 0,
|
|
86
|
+
avgDuration: 0,
|
|
87
|
+
maxDuration: 0,
|
|
88
|
+
minDuration: 0,
|
|
89
|
+
percentilesDuration: percents.map((percent) => {
|
|
90
|
+
return {
|
|
91
|
+
name: String(percent),
|
|
92
|
+
value: 0
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
// totalPrice: 0,
|
|
96
|
+
// maxPrice: 0,
|
|
97
|
+
// minPrice: 0,
|
|
98
|
+
// avgPrice: 0
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const ranks4percentile = percents.map((percentile) => {
|
|
103
|
+
return {
|
|
104
|
+
percentile,
|
|
105
|
+
rank: Math.floor(aggregations[0].transactionCount * percentile / 100)
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
const aggregations2 = await this.transactionModel.aggregate([
|
|
109
|
+
{
|
|
110
|
+
$match: matchConditions
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
$project: {
|
|
114
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
115
|
+
status: '$status',
|
|
116
|
+
startDate: '$startDate',
|
|
117
|
+
endDate: '$endDate',
|
|
118
|
+
typeOf: '$typeOf'
|
|
119
|
+
// result: '$result',
|
|
120
|
+
// price: {
|
|
121
|
+
// $cond: {
|
|
122
|
+
// if: { $isNumber: '$result.order.price' },
|
|
123
|
+
// then: '$result.order.price',
|
|
124
|
+
// else: 0
|
|
125
|
+
// }
|
|
126
|
+
// }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{ $sort: { duration: 1 } },
|
|
130
|
+
{
|
|
131
|
+
$group: {
|
|
132
|
+
_id: '$typeOf',
|
|
133
|
+
durations: { $push: '$duration' }
|
|
134
|
+
// totalPrice: { $sum: '$price' },
|
|
135
|
+
// maxPrice: { $max: '$price' },
|
|
136
|
+
// minPrice: { $min: '$price' },
|
|
137
|
+
// avgPrice: { $avg: '$price' }
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
$project: {
|
|
142
|
+
_id: 0,
|
|
143
|
+
percentilesDuration: ranks4percentile.map((rank) => {
|
|
144
|
+
return {
|
|
145
|
+
name: String(rank.percentile),
|
|
146
|
+
value: { $arrayElemAt: ['$durations', rank.rank] }
|
|
147
|
+
};
|
|
148
|
+
})
|
|
149
|
+
// totalPrice: '$totalPrice',
|
|
150
|
+
// maxPrice: '$maxPrice',
|
|
151
|
+
// minPrice: '$minPrice',
|
|
152
|
+
// avgPrice: '$avgPrice'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
])
|
|
156
|
+
.exec();
|
|
157
|
+
return {
|
|
158
|
+
status: transactionStatus,
|
|
159
|
+
aggregation: {
|
|
160
|
+
...aggregations[0],
|
|
161
|
+
...aggregations2[0]
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.AggregateTransactionRepo = AggregateTransactionRepo;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../factory';
|
|
3
|
+
import type { IAggregateAction } from './aggregateAction';
|
|
4
|
+
type IAvailableActionType = factory.actionType.UseAction;
|
|
5
|
+
/**
|
|
6
|
+
* 予約使用アクション集計リポジトリ
|
|
7
|
+
*/
|
|
8
|
+
export declare class AggregateUseActionRepo {
|
|
9
|
+
private readonly useActionModel;
|
|
10
|
+
constructor(connection: Connection);
|
|
11
|
+
/**
|
|
12
|
+
* アクションタイプによる汎用的な集計
|
|
13
|
+
*/
|
|
14
|
+
aggregateByTypeOf(params: {
|
|
15
|
+
project?: {
|
|
16
|
+
id?: {
|
|
17
|
+
$ne?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
startFrom: Date;
|
|
21
|
+
startThrough: Date;
|
|
22
|
+
typeOf: IAvailableActionType;
|
|
23
|
+
}): Promise<IAggregateAction>;
|
|
24
|
+
aggregateCheckMovieTicketAction(params: {
|
|
25
|
+
project?: {
|
|
26
|
+
id?: {
|
|
27
|
+
$ne?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
startFrom: Date;
|
|
31
|
+
startThrough: Date;
|
|
32
|
+
}): Promise<IAggregateAction>;
|
|
33
|
+
private agggregateByStatus;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateUseActionRepo = void 0;
|
|
4
|
+
const factory_1 = require("../factory");
|
|
5
|
+
const use_1 = require("./mongoose/schemas/action/use");
|
|
6
|
+
/**
|
|
7
|
+
* 予約使用アクション集計リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class AggregateUseActionRepo {
|
|
10
|
+
useActionModel;
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
this.useActionModel = connection.model(use_1.modelName, (0, use_1.createSchema)());
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* アクションタイプによる汎用的な集計
|
|
16
|
+
*/
|
|
17
|
+
async aggregateByTypeOf(params) {
|
|
18
|
+
const statuses = await Promise.all([
|
|
19
|
+
factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
20
|
+
factory_1.factory.actionStatusType.CanceledActionStatus,
|
|
21
|
+
factory_1.factory.actionStatusType.FailedActionStatus
|
|
22
|
+
].map(async (actionStatus) => {
|
|
23
|
+
const matchConditions = {
|
|
24
|
+
startDate: {
|
|
25
|
+
$gte: params.startFrom,
|
|
26
|
+
$lte: params.startThrough
|
|
27
|
+
},
|
|
28
|
+
typeOf: { $eq: params.typeOf },
|
|
29
|
+
actionStatus: { $eq: actionStatus },
|
|
30
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
31
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
32
|
+
: undefined
|
|
33
|
+
};
|
|
34
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
35
|
+
}));
|
|
36
|
+
return { statuses };
|
|
37
|
+
}
|
|
38
|
+
async aggregateCheckMovieTicketAction(params) {
|
|
39
|
+
const statuses = await Promise.all([
|
|
40
|
+
factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
41
|
+
factory_1.factory.actionStatusType.CanceledActionStatus,
|
|
42
|
+
factory_1.factory.actionStatusType.FailedActionStatus
|
|
43
|
+
].map(async (actionStatus) => {
|
|
44
|
+
const matchConditions = {
|
|
45
|
+
startDate: {
|
|
46
|
+
$gte: params.startFrom,
|
|
47
|
+
$lte: params.startThrough
|
|
48
|
+
},
|
|
49
|
+
typeOf: { $eq: factory_1.factory.actionType.CheckAction },
|
|
50
|
+
'object.typeOf': {
|
|
51
|
+
$exists: true,
|
|
52
|
+
$eq: factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
53
|
+
},
|
|
54
|
+
actionStatus: { $eq: actionStatus },
|
|
55
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
56
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
57
|
+
: undefined
|
|
58
|
+
};
|
|
59
|
+
return this.agggregateByStatus({ matchConditions, actionStatus });
|
|
60
|
+
}));
|
|
61
|
+
return { statuses };
|
|
62
|
+
}
|
|
63
|
+
async agggregateByStatus(params) {
|
|
64
|
+
const aggregations = await this.useActionModel.aggregate([
|
|
65
|
+
{ $match: params.matchConditions },
|
|
66
|
+
{
|
|
67
|
+
$project: {
|
|
68
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
69
|
+
actionStatus: '$actionStatus',
|
|
70
|
+
startDate: '$startDate',
|
|
71
|
+
endDate: '$endDate',
|
|
72
|
+
typeOf: '$typeOf'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
$group: {
|
|
77
|
+
_id: '$typeOf',
|
|
78
|
+
actionCount: { $sum: 1 },
|
|
79
|
+
maxDuration: { $max: '$duration' },
|
|
80
|
+
minDuration: { $min: '$duration' },
|
|
81
|
+
avgDuration: { $avg: '$duration' }
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
$project: {
|
|
86
|
+
_id: 0,
|
|
87
|
+
actionCount: '$actionCount',
|
|
88
|
+
avgDuration: '$avgDuration',
|
|
89
|
+
maxDuration: '$maxDuration',
|
|
90
|
+
minDuration: '$minDuration'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
])
|
|
94
|
+
.exec();
|
|
95
|
+
const percents = [50, 95, 99];
|
|
96
|
+
if (aggregations.length === 0) {
|
|
97
|
+
return {
|
|
98
|
+
status: params.actionStatus,
|
|
99
|
+
aggregation: {
|
|
100
|
+
actionCount: 0,
|
|
101
|
+
avgDuration: 0,
|
|
102
|
+
maxDuration: 0,
|
|
103
|
+
minDuration: 0,
|
|
104
|
+
percentilesDuration: percents.map((percent) => {
|
|
105
|
+
return {
|
|
106
|
+
name: String(percent),
|
|
107
|
+
value: 0
|
|
108
|
+
};
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const ranks4percentile = percents.map((percentile) => {
|
|
114
|
+
return {
|
|
115
|
+
percentile,
|
|
116
|
+
rank: Math.floor(aggregations[0].actionCount * percentile / 100)
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
const aggregations2 = await this.useActionModel.aggregate([
|
|
120
|
+
{
|
|
121
|
+
$match: params.matchConditions
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
$project: {
|
|
125
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
126
|
+
actionStatus: '$actionStatus',
|
|
127
|
+
startDate: '$startDate',
|
|
128
|
+
endDate: '$endDate',
|
|
129
|
+
typeOf: '$typeOf'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{ $sort: { duration: 1 } },
|
|
133
|
+
{
|
|
134
|
+
$group: {
|
|
135
|
+
_id: '$typeOf',
|
|
136
|
+
durations: { $push: '$duration' }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
$project: {
|
|
141
|
+
_id: 0,
|
|
142
|
+
avgSmallDuration: '$avgSmallDuration',
|
|
143
|
+
avgMediumDuration: '$avgMediumDuration',
|
|
144
|
+
avgLargeDuration: '$avgLargeDuration',
|
|
145
|
+
percentilesDuration: ranks4percentile.map((rank) => {
|
|
146
|
+
return {
|
|
147
|
+
name: String(rank.percentile),
|
|
148
|
+
value: { $arrayElemAt: ['$durations', rank.rank] }
|
|
149
|
+
};
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
])
|
|
154
|
+
.exec();
|
|
155
|
+
return {
|
|
156
|
+
status: params.actionStatus,
|
|
157
|
+
aggregation: {
|
|
158
|
+
...aggregations[0],
|
|
159
|
+
...aggregations2[0]
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.AggregateUseActionRepo = AggregateUseActionRepo;
|
|
@@ -22,14 +22,6 @@ export declare class AggregationRepo {
|
|
|
22
22
|
$lte?: Date;
|
|
23
23
|
};
|
|
24
24
|
}): Promise<IAggregation[]>;
|
|
25
|
-
/**
|
|
26
|
-
* 不要な集計を削除する
|
|
27
|
-
*/
|
|
28
|
-
deleteAggregateStartPassedCertainPeriod(params: {
|
|
29
|
-
aggregateStart: {
|
|
30
|
-
$lt: Date;
|
|
31
|
-
};
|
|
32
|
-
}): Promise<import("mongodb").DeleteResult>;
|
|
33
25
|
unsetUnnecessaryFields(params: {
|
|
34
26
|
filter: any;
|
|
35
27
|
$unset: any;
|
|
@@ -47,16 +47,6 @@ class AggregationRepo {
|
|
|
47
47
|
.sort({ aggregateStart: factory_1.factory.sortType.Ascending })
|
|
48
48
|
.exec();
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
* 不要な集計を削除する
|
|
52
|
-
*/
|
|
53
|
-
async deleteAggregateStartPassedCertainPeriod(params) {
|
|
54
|
-
const filter = {
|
|
55
|
-
aggregateStart: { $lt: params.aggregateStart.$lt }
|
|
56
|
-
};
|
|
57
|
-
return this.aggregationModel.deleteMany(filter)
|
|
58
|
-
.exec();
|
|
59
|
-
}
|
|
60
50
|
async unsetUnnecessaryFields(params) {
|
|
61
51
|
return this.aggregationModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
62
52
|
.exec();
|