@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.
- package/lib/chevre/eventEmitter/task.d.ts +2 -1
- package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
- package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
- package/lib/chevre/repo/action/acceptPay.js +47 -19
- package/lib/chevre/repo/action.d.ts +16 -9
- package/lib/chevre/repo/action.js +99 -180
- package/lib/chevre/repo/adminTask.d.ts +37 -0
- package/lib/chevre/repo/adminTask.js +163 -0
- package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
- package/lib/chevre/repo/aggregateOffer.js +16 -125
- package/lib/chevre/repo/aggregateTask.d.ts +37 -0
- package/lib/chevre/repo/aggregateTask.js +136 -0
- package/lib/chevre/repo/asyncAction.d.ts +69 -0
- package/lib/chevre/repo/asyncAction.js +237 -0
- package/lib/chevre/repo/concurrentLock.d.ts +3 -1
- package/lib/chevre/repo/creativeWork.d.ts +2 -3
- package/lib/chevre/repo/credentials.d.ts +2 -1
- package/lib/chevre/repo/customerType.d.ts +2 -3
- package/lib/chevre/repo/event.d.ts +10 -11
- package/lib/chevre/repo/eventOffer.d.ts +4 -5
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
- package/lib/chevre/repo/eventSeries.d.ts +4 -5
- package/lib/chevre/repo/message.d.ts +1 -1
- package/lib/chevre/repo/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +13 -0
- package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
- package/lib/chevre/repo/mongoose/schemas/scheduledTasks.d.ts +16 -0
- package/lib/chevre/repo/mongoose/schemas/scheduledTasks.js +103 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +6 -1
- package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
- package/lib/chevre/repo/note.d.ts +3 -4
- package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
- package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
- package/lib/chevre/repo/offerCatalog.d.ts +2 -3
- package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
- package/lib/chevre/repo/order.d.ts +2 -0
- package/lib/chevre/repo/order.js +14 -14
- package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
- package/lib/chevre/repo/orderInTransaction.js +181 -3
- package/lib/chevre/repo/passport.d.ts +2 -1
- package/lib/chevre/repo/person.d.ts +0 -15
- package/lib/chevre/repo/person.js +122 -108
- package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
- package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
- package/lib/chevre/repo/place/seat.d.ts +4 -5
- package/lib/chevre/repo/place/section.d.ts +3 -4
- package/lib/chevre/repo/priceSpecification.d.ts +4 -4
- package/lib/chevre/repo/product.d.ts +3 -4
- package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
- package/lib/chevre/repo/rateLimit/offer.js +0 -12
- package/lib/chevre/repo/reservation.d.ts +2 -3
- package/lib/chevre/repo/scheduledTask.d.ts +90 -0
- package/lib/chevre/repo/scheduledTask.js +223 -0
- package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
- package/lib/chevre/repo/stockHolder.d.ts +1 -1
- package/lib/chevre/repo/stockHolder.js +0 -146
- package/lib/chevre/repo/task.d.ts +30 -71
- package/lib/chevre/repo/task.js +59 -345
- package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
- package/lib/chevre/repo/transaction/placeOrder.js +43 -83
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/repo/transactionNumberCounter.js +0 -34
- package/lib/chevre/repo/transactionProcess.d.ts +2 -1
- package/lib/chevre/repo/transactionProcess.js +0 -13
- package/lib/chevre/repository.d.ts +20 -0
- package/lib/chevre/repository.js +46 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/system.d.ts +2 -2
- package/lib/chevre/service/aggregation/system.js +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +1 -1
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -67
- package/lib/chevre/service/asyncAction.d.ts +16 -0
- package/lib/chevre/service/asyncAction.js +36 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
- package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
- package/lib/chevre/service/asyncActionHandler.js +89 -0
- package/lib/chevre/service/notification/factory.d.ts +2 -4
- package/lib/chevre/service/notification/factory.js +26 -24
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +12 -6
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +12 -4
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
- package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +15 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +4 -0
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +20 -9
- package/lib/chevre/service/offer/onEventChanged.js +2 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +3 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +0 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +73 -44
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +53 -33
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +6 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +3 -7
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
- package/lib/chevre/service/order/placeOrder/factory.js +3 -21
- package/lib/chevre/service/order/placeOrder.d.ts +4 -5
- package/lib/chevre/service/order/placeOrder.js +20 -31
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
- package/lib/chevre/service/payment/any/authorize.js +7 -5
- package/lib/chevre/service/payment/any/factory.d.ts +7 -7
- package/lib/chevre/service/payment/any/factory.js +18 -21
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +7 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +34 -15
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +4 -0
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +20 -9
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +4 -0
- package/lib/chevre/service/payment/any/findCheckAction.js +20 -9
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +5 -67
- package/lib/chevre/service/payment/any/onPayActionCompleted.js +1 -1
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.js +1 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
- package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
- package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +20 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +1 -1
- package/lib/chevre/service/reserve/searchByOrder.js +2 -6
- package/lib/chevre/service/reserve.d.ts +2 -2
- package/lib/chevre/service/reserve.js +3 -3
- package/lib/chevre/service/scheduledTask.d.ts +11 -0
- package/lib/chevre/service/scheduledTask.js +40 -0
- package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.d.ts +14 -0
- package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +56 -0
- package/lib/chevre/service/scheduledTaskHandler.d.ts +12 -0
- package/lib/chevre/service/scheduledTaskHandler.js +66 -0
- package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
- package/lib/chevre/service/task/aggregateOffers.js +2 -1
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
- package/lib/chevre/service/task/cancelReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +3 -8
- package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
- package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
- package/lib/chevre/service/task/onEventChanged.js +2 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated.js +10 -9
- package/lib/chevre/service/task/placeOrder.d.ts +2 -2
- package/lib/chevre/service/task/placeOrder.js +6 -3
- package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
- package/lib/chevre/service/task/refund.d.ts +2 -2
- package/lib/chevre/service/task/refund.js +4 -10
- package/lib/chevre/service/task/reserve.d.ts +2 -2
- package/lib/chevre/service/task/reserve.js +2 -1
- package/lib/chevre/service/task/returnOrder.d.ts +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -1
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/sendOrder.d.ts +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -1
- package/lib/chevre/service/task/voidPayTransaction.js +3 -7
- package/lib/chevre/service/task/voidPayment.d.ts +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -1
- package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +1 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +36 -37
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +32 -4
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +10 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +6 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +23 -9
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +30 -40
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +1 -1
- package/lib/chevre/service.d.ts +8 -0
- package/lib/chevre/service.js +23 -1
- package/lib/chevre/taskSettings.d.ts +3 -4
- package/package.json +8 -11
- package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
- package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
- package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
- package/lib/chevre/service/reserve/findReservations.js +0 -61
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StockHolderRepo = void 0;
|
|
4
|
-
// import type { RedisClientType } from 'redis';
|
|
5
4
|
const factory_1 = require("../factory");
|
|
6
5
|
const pendingReservation_1 = require("./pendingReservation");
|
|
7
6
|
const SEARCH_OFFERS_MAX_LENGTH = 100;
|
|
@@ -9,36 +8,11 @@ const SEARCH_OFFERS_MAX_LENGTH = 100;
|
|
|
9
8
|
* 保留予約リポジトリ
|
|
10
9
|
*/
|
|
11
10
|
class StockHolderRepo {
|
|
12
|
-
// public static KEY_PREFIX_NEW: string = 'stockHolder';
|
|
13
|
-
// private readonly redisClient: RedisClientType | undefined;
|
|
14
11
|
pendingReservationRepo;
|
|
15
12
|
constructor(params) {
|
|
16
13
|
const { connection } = params;
|
|
17
|
-
// this.redisClient = redisClient;
|
|
18
14
|
this.pendingReservationRepo = new pendingReservation_1.PendingReservationRepo(connection);
|
|
19
15
|
}
|
|
20
|
-
// private static offer2field(params: IOffer, hasTicketedSeat: boolean) {
|
|
21
|
-
// if (hasTicketedSeat) {
|
|
22
|
-
// return `${params.seatSection}:${params.seatNumber}`;
|
|
23
|
-
// } else {
|
|
24
|
-
// // 予約IDをfieldにする場合
|
|
25
|
-
// const serviceOutputId = params.itemOffered?.serviceOutput?.id;
|
|
26
|
-
// if (typeof serviceOutputId === 'string') {
|
|
27
|
-
// return serviceOutputId;
|
|
28
|
-
// } else {
|
|
29
|
-
// throw new factory.errors.Internal('offer2field requires itemOffered.serviceOutput.id');
|
|
30
|
-
// }
|
|
31
|
-
// }
|
|
32
|
-
// }
|
|
33
|
-
// private static createKey(params: {
|
|
34
|
-
// eventId: string;
|
|
35
|
-
// startDate: Date;
|
|
36
|
-
// }): string {
|
|
37
|
-
// if (!(params.startDate instanceof Date)) {
|
|
38
|
-
// throw new factory.errors.Argument('startDate', 'must be Date');
|
|
39
|
-
// }
|
|
40
|
-
// return `${StockHolderRepo.KEY_PREFIX_NEW}:${params.eventId}`;
|
|
41
|
-
// }
|
|
42
16
|
/**
|
|
43
17
|
* 座席をロックする(maxキャパシティチェック有)
|
|
44
18
|
*/
|
|
@@ -54,16 +28,6 @@ class StockHolderRepo {
|
|
|
54
28
|
}
|
|
55
29
|
else {
|
|
56
30
|
throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
|
|
57
|
-
// if (this.redisClient === undefined) {
|
|
58
|
-
// throw new factory.errors.Internal('redisClient required');
|
|
59
|
-
// }
|
|
60
|
-
// const key = StockHolderRepo.createKey({ eventId: lockKey.eventId, startDate: lockKey.startDate });
|
|
61
|
-
// await this.redisClient.watch(key);
|
|
62
|
-
// const hashCount = await this.redisClient.hLen(key);
|
|
63
|
-
// if (hashCount + lockKey.offers.length > maximum) {
|
|
64
|
-
// throw new factory.errors.Argument('Event', 'maximumAttendeeCapacity exceeded');
|
|
65
|
-
// }
|
|
66
|
-
// await this.lock(lockKey);
|
|
67
31
|
}
|
|
68
32
|
}
|
|
69
33
|
/**
|
|
@@ -79,59 +43,11 @@ class StockHolderRepo {
|
|
|
79
43
|
startDate: lockKey.startDate,
|
|
80
44
|
hasTicketedSeat: lockKey.hasTicketedSeat
|
|
81
45
|
});
|
|
82
|
-
// const key = StockHolderRepo.createKey({ eventId: lockKey.eventId, startDate: lockKey.startDate });
|
|
83
|
-
// await this.checkIfConflicted({ key, eventId: lockKey.eventId, useMongoose });
|
|
84
46
|
if (useMongoose) {
|
|
85
47
|
return this.pendingReservationRepo.lock(lockKey);
|
|
86
48
|
}
|
|
87
49
|
else {
|
|
88
50
|
throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
|
|
89
|
-
// if (this.redisClient === undefined) {
|
|
90
|
-
// throw new factory.errors.Internal('redisClient required');
|
|
91
|
-
// }
|
|
92
|
-
// const value = lockKey.holder;
|
|
93
|
-
// const multi = this.redisClient.multi();
|
|
94
|
-
// const fields = lockKey.offers.map((offer) => StockHolderRepo.offer2field(offer, lockKey.hasTicketedSeat));
|
|
95
|
-
// // check uniqueness(2025-04-20~)
|
|
96
|
-
// const uniqueFields = [...new Set(fields)];
|
|
97
|
-
// if (uniqueFields.length !== fields.length) {
|
|
98
|
-
// throw new factory.errors.Argument('offers', 'offers must be unique');
|
|
99
|
-
// }
|
|
100
|
-
// fields.forEach((field) => {
|
|
101
|
-
// multi.hSetNX(key, field, value);
|
|
102
|
-
// });
|
|
103
|
-
// const results = await multi.expireAt(
|
|
104
|
-
// key,
|
|
105
|
-
// moment(lockKey.expires)
|
|
106
|
-
// .unix()
|
|
107
|
-
// )
|
|
108
|
-
// .exec();
|
|
109
|
-
// const lockedFields: string[] = [];
|
|
110
|
-
// if (Array.isArray(results)) {
|
|
111
|
-
// results.slice(0, fields.length)
|
|
112
|
-
// .forEach((r, index) => {
|
|
113
|
-
// if (r === 1 || (<any>r) === true) {
|
|
114
|
-
// lockedFields.push(fields[index]);
|
|
115
|
-
// }
|
|
116
|
-
// });
|
|
117
|
-
// }
|
|
118
|
-
// const lockedAll = lockedFields.length === fields.length;
|
|
119
|
-
// // expireAtReplyの検証も追加する(2023-04-19~)
|
|
120
|
-
// const expiredAll = results.slice(fields.length)
|
|
121
|
-
// .every((r) => (r === 1 || (<any>r) === true));
|
|
122
|
-
// if (!lockedAll || !expiredAll) {
|
|
123
|
-
// if (lockedFields.length > 0) {
|
|
124
|
-
// // 全て仮押さえできなければ仮押さえできたものは解除
|
|
125
|
-
// await this.redisClient.multi()
|
|
126
|
-
// .hDel(key, lockedFields)
|
|
127
|
-
// .exec();
|
|
128
|
-
// }
|
|
129
|
-
// if (!lockedAll) {
|
|
130
|
-
// throw new factory.errors.AlreadyInUse(factory.reservationType.EventReservation, ['ticketedSeat'], 'Already hold');
|
|
131
|
-
// } else {
|
|
132
|
-
// throw new factory.errors.Internal('timeout cannot be set unexpectedly');
|
|
133
|
-
// }
|
|
134
|
-
// }
|
|
135
51
|
}
|
|
136
52
|
}
|
|
137
53
|
/**
|
|
@@ -144,20 +60,11 @@ class StockHolderRepo {
|
|
|
144
60
|
startDate: params.startDate,
|
|
145
61
|
hasTicketedSeat: params.hasTicketedSeat
|
|
146
62
|
});
|
|
147
|
-
// const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
|
|
148
|
-
// await this.checkIfConflicted({ key, eventId: params.eventId, useMongoose });
|
|
149
63
|
if (useMongoose) {
|
|
150
64
|
return this.pendingReservationRepo.unlock(params);
|
|
151
65
|
}
|
|
152
66
|
else {
|
|
153
67
|
throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
|
|
154
|
-
// if (this.redisClient === undefined) {
|
|
155
|
-
// throw new factory.errors.Internal('redisClient required');
|
|
156
|
-
// }
|
|
157
|
-
// const field = StockHolderRepo.offer2field(params.offer, params.hasTicketedSeat);
|
|
158
|
-
// await this.redisClient.multi()
|
|
159
|
-
// .hDel(key, field)
|
|
160
|
-
// .exec();
|
|
161
68
|
}
|
|
162
69
|
}
|
|
163
70
|
/**
|
|
@@ -174,16 +81,6 @@ class StockHolderRepo {
|
|
|
174
81
|
}
|
|
175
82
|
else {
|
|
176
83
|
throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
|
|
177
|
-
// if (this.redisClient === undefined) {
|
|
178
|
-
// throw new factory.errors.Internal('redisClient required');
|
|
179
|
-
// }
|
|
180
|
-
// const key = StockHolderRepo.createKey({ eventId: params.event.id, startDate: params.event.startDate });
|
|
181
|
-
// const reply = await this.redisClient.hLen(key);
|
|
182
|
-
// let fieldCount: number = 0;
|
|
183
|
-
// if (typeof reply === 'number') {
|
|
184
|
-
// fieldCount = Number(reply);
|
|
185
|
-
// }
|
|
186
|
-
// return fieldCount;
|
|
187
84
|
}
|
|
188
85
|
}
|
|
189
86
|
/**
|
|
@@ -200,12 +97,6 @@ class StockHolderRepo {
|
|
|
200
97
|
}
|
|
201
98
|
else {
|
|
202
99
|
throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
|
|
203
|
-
// if (this.redisClient === undefined) {
|
|
204
|
-
// throw new factory.errors.Internal('redisClient required');
|
|
205
|
-
// }
|
|
206
|
-
// const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
|
|
207
|
-
// const field = StockHolderRepo.offer2field(params.offer, params.hasTicketedSeat);
|
|
208
|
-
// return this.redisClient.hGet(key, field);
|
|
209
100
|
}
|
|
210
101
|
}
|
|
211
102
|
async searchHolders(params) {
|
|
@@ -223,32 +114,8 @@ class StockHolderRepo {
|
|
|
223
114
|
}
|
|
224
115
|
else {
|
|
225
116
|
throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
|
|
226
|
-
// if (this.redisClient === undefined) {
|
|
227
|
-
// throw new factory.errors.Internal('redisClient required');
|
|
228
|
-
// }
|
|
229
|
-
// const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
|
|
230
|
-
// const fields = params.offers.map((o) => {
|
|
231
|
-
// return StockHolderRepo.offer2field(o, params.hasTicketedSeat);
|
|
232
|
-
// });
|
|
233
|
-
// // Array reply: list of values associated with the given fields, in the same order as they are requested.
|
|
234
|
-
// const result = await this.redisClient.hmGet(key, fields);
|
|
235
|
-
// if (!Array.isArray(result)) {
|
|
236
|
-
// throw new factory.errors.Internal(`searchAvailability got non-array: ${typeof result}`);
|
|
237
|
-
// }
|
|
238
|
-
// // そのまま返却(2023-04-17~)
|
|
239
|
-
// return result;
|
|
240
117
|
}
|
|
241
118
|
}
|
|
242
|
-
// public async checkIfConflicted(params: {
|
|
243
|
-
// eventId: string;
|
|
244
|
-
// startDate: Date;
|
|
245
|
-
// }): Promise<void> {
|
|
246
|
-
// const redisKeyExists = await this.redisKeyExists(params);
|
|
247
|
-
// const mongoDocExists = await this.pendingReservationRepo.docExists(params);
|
|
248
|
-
// if (redisKeyExists && mongoDocExists) {
|
|
249
|
-
// throw new factory.errors.Internal(`repository conflicted. eventId:${params.eventId}`);
|
|
250
|
-
// }
|
|
251
|
-
// }
|
|
252
119
|
/**
|
|
253
120
|
* 新リポジトリを使用するかどうか
|
|
254
121
|
*/
|
|
@@ -258,19 +125,6 @@ class StockHolderRepo {
|
|
|
258
125
|
}
|
|
259
126
|
// always use mongo(2025-08-17~)
|
|
260
127
|
return true;
|
|
261
|
-
// let useMongoose = false;
|
|
262
|
-
// const redisKeyExists = await this.redisKeyExists(params);
|
|
263
|
-
// if (redisKeyExists) {
|
|
264
|
-
// useMongoose = false;
|
|
265
|
-
// } else {
|
|
266
|
-
// // redis keyが存在しなければmongo利用
|
|
267
|
-
// useMongoose = true;
|
|
268
|
-
// }
|
|
269
|
-
// // check confliction for test
|
|
270
|
-
// if (USE_STOCK_HOLDER_CHECK_CONFLICT) {
|
|
271
|
-
// await this.checkIfConflicted(params);
|
|
272
|
-
// }
|
|
273
|
-
// return useMongoose;
|
|
274
128
|
}
|
|
275
129
|
}
|
|
276
130
|
exports.StockHolderRepo = StockHolderRepo;
|
|
@@ -1,45 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Connection, UpdateWriteOpResult } from 'mongoose';
|
|
2
2
|
import { INextFunction } from '../eventEmitter/task';
|
|
3
3
|
import { factory } from '../factory';
|
|
4
4
|
import { IModel, IDocType } from './mongoose/schemas/task';
|
|
5
5
|
import type { IExecutableTask } from '../taskSettings';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
value: number;
|
|
14
|
-
}[];
|
|
15
|
-
}
|
|
16
|
-
interface IStatus {
|
|
17
|
-
status: factory.taskStatus;
|
|
18
|
-
aggregation: IAggregationByStatus;
|
|
19
|
-
}
|
|
20
|
-
export interface IAggregateTask {
|
|
21
|
-
statuses: IStatus[];
|
|
22
|
-
}
|
|
23
|
-
interface IOptionOnCreate {
|
|
24
|
-
emitImmediately: boolean;
|
|
25
|
-
}
|
|
26
|
-
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName>;
|
|
27
|
-
type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'identifier' | 'description'>;
|
|
6
|
+
type IKeyOfProjection = keyof factory.task.ITask<factory.taskName> | 'expires';
|
|
7
|
+
/**
|
|
8
|
+
* リトライ可能なタスク作成属性
|
|
9
|
+
*/
|
|
10
|
+
type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'identifier' | 'description'> & {
|
|
11
|
+
expires?: Date;
|
|
12
|
+
};
|
|
28
13
|
/**
|
|
29
14
|
* タスクリポジトリ
|
|
30
15
|
*/
|
|
31
16
|
export declare class TaskRepo {
|
|
32
17
|
readonly taskModel: IModel;
|
|
33
18
|
constructor(connection: Connection);
|
|
34
|
-
|
|
35
|
-
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'expires' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
|
|
19
|
+
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
|
|
36
20
|
alternateName?: never;
|
|
37
21
|
identifier?: never;
|
|
38
22
|
expires: Date;
|
|
39
23
|
}, next: INextFunction): Promise<{
|
|
40
24
|
id: string;
|
|
41
25
|
}>;
|
|
42
|
-
saveMany(taskAttributes: ICreatingTask[]
|
|
26
|
+
saveMany(taskAttributes: ICreatingTask[]): Promise<{
|
|
43
27
|
id: string;
|
|
44
28
|
}[]>;
|
|
45
29
|
/**
|
|
@@ -61,12 +45,10 @@ export declare class TaskRepo {
|
|
|
61
45
|
*/
|
|
62
46
|
createIfNotExistByAlternateName(params: ICreatingTask & {
|
|
63
47
|
alternateName: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
createDeleteTransactionTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.DeleteTransaction>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>, options: IOptionOnCreate): Promise<void>;
|
|
69
|
-
createOnAssetTransactionStatusChangedTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>, options: IOptionOnCreate): Promise<void>;
|
|
48
|
+
identifier: string;
|
|
49
|
+
expires?: never;
|
|
50
|
+
}): Promise<void>;
|
|
51
|
+
createOnAssetTransactionStatusChangedTaskIfNotExist(params: Pick<factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>): Promise<void>;
|
|
70
52
|
/**
|
|
71
53
|
* Ready -> remainingNumberOfTriesが1減る
|
|
72
54
|
* Running -> findOneするだけ
|
|
@@ -137,7 +119,7 @@ export declare class TaskRepo {
|
|
|
137
119
|
name: string;
|
|
138
120
|
};
|
|
139
121
|
nameFilterBeforeRunsAt: boolean;
|
|
140
|
-
}
|
|
122
|
+
}): Promise<Pick<factory.task.ITask<factory.taskName>, 'id' | 'name'> | null>;
|
|
141
123
|
/**
|
|
142
124
|
* Readyのままで期限切れのタスクをExpiredに変更する
|
|
143
125
|
*/
|
|
@@ -190,28 +172,28 @@ export declare class TaskRepo {
|
|
|
190
172
|
status: factory.taskStatus.Executed | factory.taskStatus.Running | factory.taskStatus.Aborted;
|
|
191
173
|
executionResult: factory.task.IExecutionResult;
|
|
192
174
|
}, next?: INextFunction): Promise<void>;
|
|
193
|
-
count(params: factory.task.ISearchConditions): Promise<{
|
|
194
|
-
count: number;
|
|
195
|
-
}>;
|
|
196
175
|
/**
|
|
197
|
-
*
|
|
176
|
+
* タスクの状態を参照する
|
|
177
|
+
* 非同期アクション移行が完了したら廃止する(2026-07-29~)
|
|
198
178
|
*/
|
|
199
|
-
|
|
179
|
+
findTaskById(params: {
|
|
180
|
+
id: {
|
|
181
|
+
$eq: string;
|
|
182
|
+
};
|
|
183
|
+
project: {
|
|
184
|
+
id: {
|
|
185
|
+
$eq: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
name: factory.taskName;
|
|
189
|
+
}, inclusion: IKeyOfProjection[]): Promise<(IDocType & {
|
|
190
|
+
id: string;
|
|
191
|
+
} | undefined)>;
|
|
200
192
|
deleteByProject(params: {
|
|
201
193
|
project: {
|
|
202
194
|
id: string;
|
|
203
195
|
};
|
|
204
196
|
}): Promise<void>;
|
|
205
|
-
deleteByName(params: {
|
|
206
|
-
name: factory.taskName;
|
|
207
|
-
status?: {
|
|
208
|
-
$eq?: factory.taskStatus;
|
|
209
|
-
};
|
|
210
|
-
runsAt?: {
|
|
211
|
-
$gte: Date;
|
|
212
|
-
$lte: Date;
|
|
213
|
-
};
|
|
214
|
-
}): Promise<import("mongodb").DeleteResult>;
|
|
215
197
|
/**
|
|
216
198
|
* 不要なタスクを削除する
|
|
217
199
|
*/
|
|
@@ -229,28 +211,5 @@ export declare class TaskRepo {
|
|
|
229
211
|
}): Promise<{
|
|
230
212
|
count: number;
|
|
231
213
|
}>;
|
|
232
|
-
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, {}> & IDocType & {
|
|
233
|
-
_id: import("mongoose").Types.ObjectId;
|
|
234
|
-
} & {
|
|
235
|
-
__v: number;
|
|
236
|
-
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & IDocType & {
|
|
237
|
-
_id: import("mongoose").Types.ObjectId;
|
|
238
|
-
} & {
|
|
239
|
-
__v: number;
|
|
240
|
-
}) | null>;
|
|
241
|
-
unsetUnnecessaryFields(params: {
|
|
242
|
-
filter: FilterQuery<factory.task.ITask<factory.taskName>>;
|
|
243
|
-
$unset: AnyKeys<factory.task.ITask<factory.taskName>>;
|
|
244
|
-
}): Promise<UpdateWriteOpResult>;
|
|
245
|
-
aggregateTask(params: {
|
|
246
|
-
project?: {
|
|
247
|
-
id?: {
|
|
248
|
-
$ne?: string;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
runsFrom: Date;
|
|
252
|
-
runsThrough: Date;
|
|
253
|
-
}): Promise<IAggregateTask>;
|
|
254
|
-
private agggregateByStatus;
|
|
255
214
|
}
|
|
256
215
|
export {};
|