@chevre/domain 21.2.0-alpha.13 → 21.2.0-alpha.130
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/example/src/chevre/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/aggregation/aggregateSystem.ts +85 -27
- package/example/src/chevre/countDelayedTasks.ts +7 -2
- package/example/src/chevre/deleteTasksByName.ts +10 -2
- package/example/src/chevre/findMovieTheaterById.ts +40 -0
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/lockStockHolder.ts +5 -2
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
- package/example/src/chevre/processPay.ts +5 -1
- package/example/src/chevre/processRegisterMembership.ts +8 -4
- package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
- package/example/src/chevre/processReserve.ts +5 -2
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +34 -0
- package/example/src/chevre/searchActions.ts +33 -0
- package/example/src/chevre/searchEventSeats.ts +5 -2
- package/example/src/chevre/searchHoldReservations.ts +38 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchScreeningRooms.ts +23 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
- package/example/src/chevre/transaction/startExportTasks.ts +2 -1
- package/example/src/chevre/updateScreeningRoom.ts +41 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/example/src/playOnMoment.ts +24 -0
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/account.js +3 -2
- package/lib/chevre/repo/accountTransaction.d.ts +3 -1
- package/lib/chevre/repo/accountTransaction.js +3 -2
- package/lib/chevre/repo/action.d.ts +42 -2
- package/lib/chevre/repo/action.js +130 -57
- package/lib/chevre/repo/additionalProperty.js +2 -1
- package/lib/chevre/repo/aggregation.d.ts +3 -0
- package/lib/chevre/repo/aggregation.js +3 -0
- package/lib/chevre/repo/assetTransaction.d.ts +23 -8
- package/lib/chevre/repo/assetTransaction.js +253 -80
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +37 -25
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +22 -6
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +2 -4
- package/lib/chevre/repo/creativeWork.js +35 -12
- package/lib/chevre/repo/customer.js +2 -1
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +2 -1
- package/lib/chevre/repo/event.d.ts +27 -1
- package/lib/chevre/repo/event.js +67 -33
- package/lib/chevre/repo/member.js +4 -3
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +62 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
- package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.js +0 -27
- package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +121 -0
- package/lib/chevre/repo/order.d.ts +55 -3
- package/lib/chevre/repo/order.js +62 -10
- package/lib/chevre/repo/ownershipInfo.js +2 -7
- package/lib/chevre/repo/place.d.ts +20 -5
- package/lib/chevre/repo/place.js +63 -23
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +1 -3
- package/lib/chevre/repo/product.js +25 -4
- package/lib/chevre/repo/project.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +20 -4
- package/lib/chevre/repo/reservation.js +40 -59
- package/lib/chevre/repo/role.js +3 -2
- package/lib/chevre/repo/seller.d.ts +1 -1
- package/lib/chevre/repo/seller.js +44 -23
- package/lib/chevre/repo/serviceOutput.js +2 -1
- package/lib/chevre/repo/stockHolder.d.ts +137 -7
- package/lib/chevre/repo/stockHolder.js +527 -102
- package/lib/chevre/repo/task.d.ts +45 -2
- package/lib/chevre/repo/task.js +94 -15
- package/lib/chevre/repo/transaction.d.ts +21 -2
- package/lib/chevre/repo/transaction.js +171 -50
- package/lib/chevre/repo/trip.js +2 -1
- package/lib/chevre/repository.d.ts +5 -2
- package/lib/chevre/repository.js +8 -4
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +8 -6
- package/lib/chevre/service/aggregation/system.d.ts +110 -23
- package/lib/chevre/service/aggregation/system.js +213 -91
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/pay.js +20 -34
- package/lib/chevre/service/assetTransaction/refund.js +2 -24
- package/lib/chevre/service/assetTransaction/registerService.js +1 -25
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
- package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
- package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
- package/lib/chevre/service/assetTransaction/reserve.js +92 -69
- package/lib/chevre/service/assetTransaction.d.ts +6 -0
- package/lib/chevre/service/assetTransaction.js +9 -4
- package/lib/chevre/service/event.js +25 -6
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +41 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
- package/lib/chevre/service/offer/event/authorize.js +8 -2
- package/lib/chevre/service/offer/event/factory.d.ts +3 -0
- package/lib/chevre/service/offer/event/factory.js +16 -5
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/offer.d.ts +16 -8
- package/lib/chevre/service/offer.js +71 -8
- package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
- package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
- package/lib/chevre/service/order/onOrderUpdated.js +22 -0
- package/lib/chevre/service/order/placeOrder.d.ts +1 -0
- package/lib/chevre/service/order/placeOrder.js +41 -24
- package/lib/chevre/service/order/returnOrder.d.ts +1 -0
- package/lib/chevre/service/order/returnOrder.js +7 -12
- package/lib/chevre/service/order/sendOrder.d.ts +1 -0
- package/lib/chevre/service/order/sendOrder.js +7 -10
- package/lib/chevre/service/order.d.ts +2 -1
- package/lib/chevre/service/order.js +3 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +9 -5
- package/lib/chevre/service/payment/any.js +80 -18
- package/lib/chevre/service/payment/creditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +23 -17
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
- package/lib/chevre/service/payment/movieTicket/validation.js +55 -32
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +7 -6
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
- package/lib/chevre/service/reserve/cancelReservation.js +162 -142
- package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
- package/lib/chevre/service/reserve/checkInReservation.js +77 -3
- package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
- package/lib/chevre/service/reserve/confirmReservation.js +133 -58
- package/lib/chevre/service/reserve/factory.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
- package/lib/chevre/service/reserve/useReservation.js +61 -71
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
- package/lib/chevre/service/reserve.d.ts +3 -2
- package/lib/chevre/service/reserve.js +4 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
- package/lib/chevre/service/task/cancelReservation.js +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +10 -8
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
- package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
- package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
- package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
- package/lib/chevre/service/task/onResourceUpdated.js +352 -0
- package/lib/chevre/service/task/placeOrder.js +1 -1
- package/lib/chevre/service/task/reserve.js +10 -7
- package/lib/chevre/service/task/returnOrder.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +2 -12
- package/lib/chevre/service/task/sendOrder.js +1 -1
- package/lib/chevre/service/task/useReservation.d.ts +7 -0
- package/lib/chevre/service/task/useReservation.js +36 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +43 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
- package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder.js +228 -36
- package/lib/chevre/service/transaction.d.ts +7 -13
- package/lib/chevre/service/transaction.js +12 -139
- package/lib/chevre/settings.d.ts +13 -1
- package/lib/chevre/settings.js +56 -6
- package/package.json +5 -5
- package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
- package/example/src/chevre/eventCatalog2eventService.ts +0 -123
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
- package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
- package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
- package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const accountTitle_1 = require("../../repo/accountTitle");
|
|
15
|
+
const categoryCode_1 = require("../../repo/categoryCode");
|
|
16
|
+
const creativeWork_1 = require("../../repo/creativeWork");
|
|
17
|
+
const place_1 = require("../../repo/place");
|
|
18
|
+
const product_1 = require("../../repo/product");
|
|
19
|
+
const task_1 = require("../../repo/task");
|
|
20
|
+
const settings_1 = require("../../settings");
|
|
21
|
+
const informResources = settings_1.settings.onResourceUpdated.informResource;
|
|
22
|
+
/**
|
|
23
|
+
* タスク実行関数
|
|
24
|
+
*/
|
|
25
|
+
function call(data) {
|
|
26
|
+
return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
yield onResourceUpdated(data)({
|
|
28
|
+
accountTitle: new accountTitle_1.MongoRepository(connectionSettings.connection),
|
|
29
|
+
categoryCode: new categoryCode_1.MongoRepository(connectionSettings.connection),
|
|
30
|
+
creativeWork: new creativeWork_1.MongoRepository(connectionSettings.connection),
|
|
31
|
+
place: new place_1.MongoRepository(connectionSettings.connection),
|
|
32
|
+
product: new product_1.MongoRepository(connectionSettings.connection),
|
|
33
|
+
task: new task_1.MongoRepository(connectionSettings.connection)
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.call = call;
|
|
38
|
+
function onResourceUpdated(params) {
|
|
39
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (params.useInform === true) {
|
|
41
|
+
switch (params.typeOf) {
|
|
42
|
+
case factory.creativeWorkType.Movie:
|
|
43
|
+
yield createInformMovieTasks({
|
|
44
|
+
project: { id: params.project.id },
|
|
45
|
+
ids: params.id,
|
|
46
|
+
typeOf: params.typeOf
|
|
47
|
+
})(repos);
|
|
48
|
+
break;
|
|
49
|
+
case factory.product.ProductType.EventService:
|
|
50
|
+
yield createInformProductTasks({
|
|
51
|
+
project: { id: params.project.id },
|
|
52
|
+
ids: params.id,
|
|
53
|
+
typeOf: params.typeOf
|
|
54
|
+
})(repos);
|
|
55
|
+
break;
|
|
56
|
+
case 'CategoryCode':
|
|
57
|
+
yield createInformCategoryCodeTasks({
|
|
58
|
+
project: { id: params.project.id },
|
|
59
|
+
ids: params.id,
|
|
60
|
+
typeOf: params.typeOf
|
|
61
|
+
})(repos);
|
|
62
|
+
break;
|
|
63
|
+
case factory.placeType.MovieTheater:
|
|
64
|
+
yield createInformMovieTheaterTasks({
|
|
65
|
+
project: { id: params.project.id },
|
|
66
|
+
ids: params.id,
|
|
67
|
+
typeOf: params.typeOf
|
|
68
|
+
})(repos);
|
|
69
|
+
break;
|
|
70
|
+
case 'AccountTitle':
|
|
71
|
+
yield createInformAccountTitleTasks({
|
|
72
|
+
project: { id: params.project.id },
|
|
73
|
+
ids: params.id,
|
|
74
|
+
typeOf: params.typeOf
|
|
75
|
+
})(repos);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
// no op
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function createInformMovieTasks(params) {
|
|
84
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const movies4inform = yield repos.creativeWork.searchMovies({ id: { $in: params.ids } }, [
|
|
86
|
+
'additionalProperty', 'datePublished', 'duration', 'identifier', 'name', 'project',
|
|
87
|
+
'typeOf', 'distributor', 'contentRating', 'headline', 'thumbnailUrl'
|
|
88
|
+
], []);
|
|
89
|
+
if (movies4inform.length > 0) {
|
|
90
|
+
const taskRunsAt = new Date();
|
|
91
|
+
const informTasks = [];
|
|
92
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
93
|
+
var _a;
|
|
94
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
95
|
+
movies4inform.forEach((movie4inform) => {
|
|
96
|
+
var _a;
|
|
97
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
98
|
+
delete movie4inform._id;
|
|
99
|
+
const informActionAttributes = {
|
|
100
|
+
agent: movie4inform.project,
|
|
101
|
+
object: movie4inform,
|
|
102
|
+
project: movie4inform.project,
|
|
103
|
+
recipient: {
|
|
104
|
+
id: '',
|
|
105
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
106
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
107
|
+
url: informUrl
|
|
108
|
+
},
|
|
109
|
+
typeOf: factory.actionType.InformAction
|
|
110
|
+
};
|
|
111
|
+
informTasks.push({
|
|
112
|
+
project: movie4inform.project,
|
|
113
|
+
name: factory.taskName.TriggerWebhook,
|
|
114
|
+
status: factory.taskStatus.Ready,
|
|
115
|
+
runsAt: taskRunsAt,
|
|
116
|
+
remainingNumberOfTries: 10,
|
|
117
|
+
numberOfTried: 0,
|
|
118
|
+
executionResults: [],
|
|
119
|
+
data: informActionAttributes
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
if (informTasks.length > 0) {
|
|
124
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function createInformProductTasks(params) {
|
|
130
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const products4inform = yield repos.product.search({
|
|
132
|
+
typeOf: { $eq: params.typeOf },
|
|
133
|
+
id: { $in: params.ids }
|
|
134
|
+
}, ['additionalProperty', 'description', 'name', 'productID', 'project', 'typeOf', 'serviceType'], []);
|
|
135
|
+
if (products4inform.length > 0) {
|
|
136
|
+
const taskRunsAt = new Date();
|
|
137
|
+
const informTasks = [];
|
|
138
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
139
|
+
var _a;
|
|
140
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
141
|
+
products4inform.forEach((product4inform) => {
|
|
142
|
+
var _a;
|
|
143
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
144
|
+
delete product4inform._id;
|
|
145
|
+
const informActionAttributes = {
|
|
146
|
+
agent: product4inform.project,
|
|
147
|
+
object: product4inform,
|
|
148
|
+
project: product4inform.project,
|
|
149
|
+
recipient: {
|
|
150
|
+
id: '',
|
|
151
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
152
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
153
|
+
url: informUrl
|
|
154
|
+
},
|
|
155
|
+
typeOf: factory.actionType.InformAction
|
|
156
|
+
};
|
|
157
|
+
informTasks.push({
|
|
158
|
+
project: product4inform.project,
|
|
159
|
+
name: factory.taskName.TriggerWebhook,
|
|
160
|
+
status: factory.taskStatus.Ready,
|
|
161
|
+
runsAt: taskRunsAt,
|
|
162
|
+
remainingNumberOfTries: 10,
|
|
163
|
+
numberOfTried: 0,
|
|
164
|
+
executionResults: [],
|
|
165
|
+
data: informActionAttributes
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
if (informTasks.length > 0) {
|
|
170
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function createInformCategoryCodeTasks(params) {
|
|
176
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const categoryCodes4inform = yield repos.categoryCode.search({
|
|
178
|
+
id: { $in: params.ids },
|
|
179
|
+
// ひとまずDistributorTypeのみ
|
|
180
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
|
181
|
+
}, ['name', 'additionalProperty', 'project', 'typeOf', 'codeValue', 'inCodeSet'], []);
|
|
182
|
+
if (categoryCodes4inform.length > 0) {
|
|
183
|
+
const taskRunsAt = new Date();
|
|
184
|
+
const informTasks = [];
|
|
185
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
186
|
+
var _a;
|
|
187
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
188
|
+
categoryCodes4inform.forEach((categoryCode4inform) => {
|
|
189
|
+
var _a;
|
|
190
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
191
|
+
delete categoryCode4inform._id;
|
|
192
|
+
const informActionAttributes = {
|
|
193
|
+
agent: categoryCode4inform.project,
|
|
194
|
+
object: categoryCode4inform,
|
|
195
|
+
project: categoryCode4inform.project,
|
|
196
|
+
recipient: {
|
|
197
|
+
id: '',
|
|
198
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
199
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
200
|
+
url: informUrl
|
|
201
|
+
},
|
|
202
|
+
typeOf: factory.actionType.InformAction
|
|
203
|
+
};
|
|
204
|
+
informTasks.push({
|
|
205
|
+
project: categoryCode4inform.project,
|
|
206
|
+
name: factory.taskName.TriggerWebhook,
|
|
207
|
+
status: factory.taskStatus.Ready,
|
|
208
|
+
runsAt: taskRunsAt,
|
|
209
|
+
remainingNumberOfTries: 10,
|
|
210
|
+
numberOfTried: 0,
|
|
211
|
+
executionResults: [],
|
|
212
|
+
data: informActionAttributes
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
if (informTasks.length > 0) {
|
|
217
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function createInformMovieTheaterTasks(params) {
|
|
223
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
if (params.ids.length !== 1) {
|
|
225
|
+
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
226
|
+
}
|
|
227
|
+
const movieTheater = yield repos.place.findById({ id: params.ids[0] }, [
|
|
228
|
+
'additionalProperty',
|
|
229
|
+
'branchCode',
|
|
230
|
+
'hasEntranceGate',
|
|
231
|
+
'hasPOS',
|
|
232
|
+
'kanaName',
|
|
233
|
+
'name',
|
|
234
|
+
'parentOrganization',
|
|
235
|
+
'project',
|
|
236
|
+
'telephone',
|
|
237
|
+
'url',
|
|
238
|
+
'typeOf',
|
|
239
|
+
'containsPlace.branchCode',
|
|
240
|
+
'containsPlace.name',
|
|
241
|
+
'containsPlace.typeOf',
|
|
242
|
+
'containsPlace.additionalProperty',
|
|
243
|
+
'containsPlace.address'
|
|
244
|
+
], []);
|
|
245
|
+
if (movieTheater.project.id !== params.project.id) {
|
|
246
|
+
throw new factory.errors.Argument('project.id', 'project.id not matched');
|
|
247
|
+
}
|
|
248
|
+
const movieTheaters4inform = [movieTheater];
|
|
249
|
+
if (movieTheaters4inform.length > 0) {
|
|
250
|
+
const taskRunsAt = new Date();
|
|
251
|
+
const informTasks = [];
|
|
252
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
253
|
+
var _a;
|
|
254
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
255
|
+
movieTheaters4inform.forEach((movieTheater4inform) => {
|
|
256
|
+
var _a;
|
|
257
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
258
|
+
delete movieTheater4inform._id;
|
|
259
|
+
const informActionAttributes = {
|
|
260
|
+
agent: movieTheater4inform.project,
|
|
261
|
+
object: movieTheater4inform,
|
|
262
|
+
project: movieTheater4inform.project,
|
|
263
|
+
recipient: {
|
|
264
|
+
id: '',
|
|
265
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
266
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
267
|
+
url: informUrl
|
|
268
|
+
},
|
|
269
|
+
typeOf: factory.actionType.InformAction
|
|
270
|
+
};
|
|
271
|
+
informTasks.push({
|
|
272
|
+
project: movieTheater4inform.project,
|
|
273
|
+
name: factory.taskName.TriggerWebhook,
|
|
274
|
+
status: factory.taskStatus.Ready,
|
|
275
|
+
runsAt: taskRunsAt,
|
|
276
|
+
remainingNumberOfTries: 10,
|
|
277
|
+
numberOfTried: 0,
|
|
278
|
+
executionResults: [],
|
|
279
|
+
data: informActionAttributes
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
if (informTasks.length > 0) {
|
|
284
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function createInformAccountTitleTasks(params) {
|
|
290
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
if (params.ids.length !== 1) {
|
|
292
|
+
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
293
|
+
}
|
|
294
|
+
const accountTitle = yield repos.accountTitle.accountTitleModel.findOne({
|
|
295
|
+
_id: { $eq: params.ids[0] },
|
|
296
|
+
'project.id': { $eq: params.project.id }
|
|
297
|
+
}, {
|
|
298
|
+
additionalProperty: 1,
|
|
299
|
+
codeValue: 1,
|
|
300
|
+
hasCategoryCode: 1,
|
|
301
|
+
name: 1,
|
|
302
|
+
project: 1,
|
|
303
|
+
typeOf: 1
|
|
304
|
+
})
|
|
305
|
+
.exec()
|
|
306
|
+
.then((doc) => {
|
|
307
|
+
if (doc === null) {
|
|
308
|
+
throw new factory.errors.NotFound(params.typeOf);
|
|
309
|
+
}
|
|
310
|
+
return doc.toObject();
|
|
311
|
+
});
|
|
312
|
+
const accountTitles4inform = [accountTitle];
|
|
313
|
+
if (accountTitles4inform.length > 0) {
|
|
314
|
+
const taskRunsAt = new Date();
|
|
315
|
+
const informTasks = [];
|
|
316
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
317
|
+
var _a;
|
|
318
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
319
|
+
accountTitles4inform.forEach((accountTitle4inform) => {
|
|
320
|
+
var _a;
|
|
321
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
322
|
+
delete accountTitle4inform._id;
|
|
323
|
+
const informActionAttributes = {
|
|
324
|
+
agent: accountTitle4inform.project,
|
|
325
|
+
object: accountTitle4inform,
|
|
326
|
+
project: accountTitle4inform.project,
|
|
327
|
+
recipient: {
|
|
328
|
+
id: '',
|
|
329
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
330
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
331
|
+
url: informUrl
|
|
332
|
+
},
|
|
333
|
+
typeOf: factory.actionType.InformAction
|
|
334
|
+
};
|
|
335
|
+
informTasks.push({
|
|
336
|
+
project: accountTitle4inform.project,
|
|
337
|
+
name: factory.taskName.TriggerWebhook,
|
|
338
|
+
status: factory.taskStatus.Ready,
|
|
339
|
+
runsAt: taskRunsAt,
|
|
340
|
+
remainingNumberOfTries: 10,
|
|
341
|
+
numberOfTried: 0,
|
|
342
|
+
executionResults: [],
|
|
343
|
+
data: informActionAttributes
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
if (informTasks.length > 0) {
|
|
348
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
@@ -32,7 +32,7 @@ function call(data) {
|
|
|
32
32
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
33
33
|
const transactionRepo = new transaction_1.MongoRepository(settings.connection);
|
|
34
34
|
const registerServiceInProgressRepo = new registerServiceInProgress_1.RedisRepository(settings.redisClient);
|
|
35
|
-
yield OrderService.placeOrder(data)({
|
|
35
|
+
yield OrderService.placeOrder(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
36
36
|
accountingReport: accountingReportRepo,
|
|
37
37
|
action: actionRepo,
|
|
38
38
|
order: orderRepo,
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const action_1 = require("../../repo/action");
|
|
14
|
+
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
14
15
|
const reservation_1 = require("../../repo/reservation");
|
|
15
16
|
const task_1 = require("../../repo/task");
|
|
16
17
|
const ReserveService = require("../reserve");
|
|
@@ -19,13 +20,15 @@ const ReserveService = require("../reserve");
|
|
|
19
20
|
*/
|
|
20
21
|
function call(data) {
|
|
21
22
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
yield ReserveService.confirmReservation({
|
|
24
|
+
actionAttributesList: data.actionAttributes,
|
|
25
|
+
useOnReservationConfirmed: true,
|
|
26
|
+
byTask: true
|
|
27
|
+
})({
|
|
28
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
29
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
30
|
+
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
31
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
29
32
|
});
|
|
30
33
|
});
|
|
31
34
|
}
|
|
@@ -32,7 +32,7 @@ function call(data) {
|
|
|
32
32
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
33
33
|
const transactionRepo = new transaction_1.MongoRepository(settings.connection);
|
|
34
34
|
const registerServiceInProgressRepo = new registerServiceInProgress_1.RedisRepository(settings.redisClient);
|
|
35
|
-
yield OrderService.returnOrder(data)({
|
|
35
|
+
yield OrderService.returnOrder(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
36
36
|
action: actionRepo,
|
|
37
37
|
order: orderRepo,
|
|
38
38
|
ownershipInfo: ownershipInfoRepo,
|
|
@@ -134,13 +134,7 @@ function refundTransactionAlreadyExists(params) {
|
|
|
134
134
|
typeOf: factory.assetTransactionType.Refund,
|
|
135
135
|
statuses: [factory.transactionStatusType.Confirmed],
|
|
136
136
|
object: { paymentMethodId: { $eq: params.object.paymentMethodId } }
|
|
137
|
-
},
|
|
138
|
-
agent: 0,
|
|
139
|
-
object: 0,
|
|
140
|
-
potentialActions: 0,
|
|
141
|
-
recipient: 0,
|
|
142
|
-
result: 0
|
|
143
|
-
});
|
|
137
|
+
}, ['_id'], []);
|
|
144
138
|
return refundTransactions.length > 0;
|
|
145
139
|
});
|
|
146
140
|
}
|
|
@@ -219,10 +213,6 @@ function onRefund(refundActionAttributes) {
|
|
|
219
213
|
});
|
|
220
214
|
}
|
|
221
215
|
// タスク保管
|
|
222
|
-
|
|
223
|
-
yield repos.task.saveMany(taskAttributes);
|
|
224
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
225
|
-
// return repos.task.save(taskAttribute);
|
|
226
|
-
// }));
|
|
216
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
227
217
|
});
|
|
228
218
|
}
|
|
@@ -32,7 +32,7 @@ function call(data) {
|
|
|
32
32
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
33
33
|
const transactionRepo = new transaction_1.MongoRepository(settings.connection);
|
|
34
34
|
const registerServiceInProgressRepo = new registerServiceInProgress_1.RedisRepository(settings.redisClient);
|
|
35
|
-
yield OrderService.sendOrder(data)({
|
|
35
|
+
yield OrderService.sendOrder(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
36
36
|
action: actionRepo,
|
|
37
37
|
order: orderRepo,
|
|
38
38
|
ownershipInfo: ownershipInfoRepo,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { IConnectionSettings } from '../task';
|
|
3
|
+
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* タスク実行関数
|
|
6
|
+
*/
|
|
7
|
+
export declare function call(data: factory.task.useReservation.IData): IOperation<void>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = void 0;
|
|
13
|
+
const action_1 = require("../../repo/action");
|
|
14
|
+
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
15
|
+
const order_1 = require("../../repo/order");
|
|
16
|
+
const reservation_1 = require("../../repo/reservation");
|
|
17
|
+
const task_1 = require("../../repo/task");
|
|
18
|
+
const reserve_1 = require("../reserve");
|
|
19
|
+
/**
|
|
20
|
+
* タスク実行関数
|
|
21
|
+
*/
|
|
22
|
+
function call(data) {
|
|
23
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
yield (0, reserve_1.useReservation)(Object.assign(Object.assign({ project: data.project, agent: data.agent, object: data.object,
|
|
26
|
+
// タスク作成前に検証済なので検証不要
|
|
27
|
+
verifyToken: false, reserveIfNotYet: data.reserveIfNotYet }, (typeof ((_a = data.instrument) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { instrument: data.instrument } : undefined), (typeof ((_b = data.location) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { location: data.location } : undefined))({
|
|
28
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
29
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
30
|
+
order: new order_1.MongoRepository(settings.connection),
|
|
31
|
+
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
32
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.call = call;
|
|
@@ -17,6 +17,7 @@ const offer_1 = require("../../repo/rateLimit/offer");
|
|
|
17
17
|
const reservation_1 = require("../../repo/reservation");
|
|
18
18
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
19
19
|
const task_1 = require("../../repo/task");
|
|
20
|
+
const transaction_1 = require("../../repo/transaction");
|
|
20
21
|
const EventOfferService = require("../offer/event");
|
|
21
22
|
/**
|
|
22
23
|
* タスク実行関数
|
|
@@ -28,7 +29,7 @@ function call(data) {
|
|
|
28
29
|
}
|
|
29
30
|
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
30
31
|
const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
|
|
31
|
-
const stockHolderRepo = new stockHolder_1.StockHolderRepository(settings.redisClient);
|
|
32
|
+
const stockHolderRepo = new stockHolder_1.StockHolderRepository(settings.redisClient, settings.connection);
|
|
32
33
|
const offerRateLimitRepo = new offer_1.RedisRepository(settings.redisClient);
|
|
33
34
|
const reservationRepo = new reservation_1.MongoRepository(settings.connection);
|
|
34
35
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
@@ -38,7 +39,8 @@ function call(data) {
|
|
|
38
39
|
stockHolder: stockHolderRepo,
|
|
39
40
|
offerRateLimit: offerRateLimitRepo,
|
|
40
41
|
reservation: reservationRepo,
|
|
41
|
-
task: taskRepo
|
|
42
|
+
task: taskRepo,
|
|
43
|
+
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
42
44
|
});
|
|
43
45
|
});
|
|
44
46
|
}
|
|
@@ -16,11 +16,20 @@ export type TaskOperation<T> = (repos: {
|
|
|
16
16
|
task: TaskRepo;
|
|
17
17
|
}) => Promise<T>;
|
|
18
18
|
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
19
|
+
export declare function executeById(params: {
|
|
20
|
+
id: string;
|
|
21
|
+
executor?: {
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
}): IOperation<void>;
|
|
19
25
|
/**
|
|
20
26
|
* タスク名でタスクをひとつ実行する
|
|
21
27
|
*/
|
|
22
28
|
export declare function executeByName<T extends factory.taskName>(params: {
|
|
23
29
|
name: T;
|
|
30
|
+
executor?: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
24
33
|
}): IOperation<void>;
|
|
25
34
|
/**
|
|
26
35
|
* タスクを実行する
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.notifyAbortedTasks = exports.abort = exports.retry = exports.execute = exports.executeByName = void 0;
|
|
12
|
+
exports.notifyAbortedTasks = exports.abort = exports.retry = exports.execute = exports.executeByName = exports.executeById = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* タスクサービス
|
|
15
15
|
*/
|
|
@@ -18,19 +18,54 @@ const factory = require("../factory");
|
|
|
18
18
|
const task_1 = require("../repo/task");
|
|
19
19
|
const NotificationService = require("./notification");
|
|
20
20
|
const factory_1 = require("./notification/factory");
|
|
21
|
+
const credentials_1 = require("../credentials");
|
|
21
22
|
const settings_1 = require("../settings");
|
|
22
23
|
const debug = createDebug('chevre-domain:service:task');
|
|
24
|
+
const DEFAULT_EXECUTOR_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
|
|
25
|
+
function executeById(params) {
|
|
26
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a;
|
|
28
|
+
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
29
|
+
// 未実行のタスクを取得
|
|
30
|
+
// tslint:disable-next-line:no-null-keyword
|
|
31
|
+
let task = null;
|
|
32
|
+
try {
|
|
33
|
+
task = yield taskRepo.executeById({
|
|
34
|
+
id: params.id,
|
|
35
|
+
executor: {
|
|
36
|
+
name: (typeof ((_a = params.executor) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? params.executor.name : DEFAULT_EXECUTOR_NAME
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
42
|
+
/* istanbul ignore next */
|
|
43
|
+
debug('service.task.executeById error:', error);
|
|
44
|
+
}
|
|
45
|
+
// タスクがなければ終了
|
|
46
|
+
if (task !== null) {
|
|
47
|
+
yield execute(task)(settings);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.executeById = executeById;
|
|
23
52
|
/**
|
|
24
53
|
* タスク名でタスクをひとつ実行する
|
|
25
54
|
*/
|
|
26
55
|
function executeByName(params) {
|
|
27
56
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
var _a;
|
|
28
58
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
29
59
|
// 未実行のタスクを取得
|
|
30
60
|
// tslint:disable-next-line:no-null-keyword
|
|
31
61
|
let task = null;
|
|
32
62
|
try {
|
|
33
|
-
task = yield taskRepo.executeOneByName(
|
|
63
|
+
task = yield taskRepo.executeOneByName({
|
|
64
|
+
name: params.name,
|
|
65
|
+
executor: {
|
|
66
|
+
name: (typeof ((_a = params.executor) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? params.executor.name : DEFAULT_EXECUTOR_NAME
|
|
67
|
+
}
|
|
68
|
+
});
|
|
34
69
|
}
|
|
35
70
|
catch (error) {
|
|
36
71
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -106,7 +141,9 @@ function abort(params) {
|
|
|
106
141
|
}
|
|
107
142
|
// 開発者へ報告
|
|
108
143
|
const message = (0, factory_1.task2lineNotify)({ task: abortedTask });
|
|
109
|
-
yield NotificationService.report2developers(message.subject, message.content)(
|
|
144
|
+
yield NotificationService.report2developers(message.subject, message.content)({
|
|
145
|
+
accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
|
|
146
|
+
});
|
|
110
147
|
}
|
|
111
148
|
});
|
|
112
149
|
}
|
|
@@ -123,7 +160,9 @@ function notifyAbortedTasks(params) {
|
|
|
123
160
|
if (abortedTasks.length > 0) {
|
|
124
161
|
// 開発者へ報告
|
|
125
162
|
const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
|
|
126
|
-
yield NotificationService.report2developers(message.subject, message.content)(
|
|
163
|
+
yield NotificationService.report2developers(message.subject, message.content)({
|
|
164
|
+
accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
|
|
165
|
+
});
|
|
127
166
|
}
|
|
128
167
|
});
|
|
129
168
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
|
+
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
|
+
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
|
+
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
6
|
+
import { MongoRepository as OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
7
|
+
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
8
|
+
import { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
9
|
+
/**
|
|
10
|
+
* 取引に関わるリソースを削除する
|
|
11
|
+
* 冪等性を確保すること
|
|
12
|
+
*/
|
|
13
|
+
export declare function deleteTransaction(params: factory.task.IData<factory.taskName.DeleteTransaction>): (repos: {
|
|
14
|
+
accountingReport: AccountingReportRepo;
|
|
15
|
+
action: ActionRepo;
|
|
16
|
+
assetTransaction: AssetTransactionRepo;
|
|
17
|
+
order: OrderRepo;
|
|
18
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
19
|
+
reservation: ReservationRepo;
|
|
20
|
+
transaction: TransactionRepo;
|
|
21
|
+
}) => Promise<void>;
|