@chevre/domain 26.0.0-alpha.4 → 26.0.0-alpha.41
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/{actionProcess.d.ts → anyAction/actionProcess.d.ts} +18 -45
- package/lib/chevre/repo/action/{actionProcess.js → anyAction/actionProcess.js} +26 -91
- 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/checkMovieTicket.d.ts +3 -1
- package/lib/chevre/repo/action/checkMovieTicket.js +8 -1
- 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/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/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 +5 -101
- package/lib/chevre/repo/action.js +7 -453
- package/lib/chevre/repo/adminAction.d.ts +87 -0
- package/lib/chevre/repo/adminAction.js +170 -0
- package/lib/chevre/repo/adminAssetTransaction.d.ts +126 -0
- package/lib/chevre/repo/adminAssetTransaction.js +491 -0
- package/lib/chevre/repo/adminAsyncAction.d.ts +2 -2
- 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/asyncAction.d.ts +2 -2
- 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 +1 -0
- 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 +5 -2
- package/lib/chevre/repo/scheduledTask.js +3 -25
- package/lib/chevre/repo/task.d.ts +45 -171
- package/lib/chevre/repo/task.js +20 -475
- 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 +50 -10
- package/lib/chevre/repository.js +112 -24
- 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/refund.js +2 -2
- 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/voidTransaction/processVoidTransaction4chevre.js +1 -3
- 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.js +4 -1
- 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 +4 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +2 -10
- 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 +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.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/returnOrder.d.ts +0 -2
- package/lib/chevre/service/order/returnOrder.js +8 -40
- 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/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/processVoidPayTransaction.js +1 -1
- 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/project.d.ts +0 -6
- package/lib/chevre/service/project.js +0 -2
- package/lib/chevre/service/reserve/cancelReservation.js +3 -3
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
- package/lib/chevre/service/reserve/useReservation.d.ts +4 -0
- package/lib/chevre/service/reserve/useReservation.js +6 -24
- 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/checkMovieTicket.js +1 -7
- package/lib/chevre/service/task/checkResource.js +14 -57
- package/lib/chevre/service/task/confirmReserveTransaction.js +3 -1
- 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/onAuthorizationCreated.js +2 -2
- 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 -8
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -13
- package/lib/chevre/service/task/returnOrder.js +2 -5
- package/lib/chevre/service/task/returnPayTransaction.js +2 -5
- 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 +4 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +5 -8
- package/lib/chevre/service/task.d.ts +3 -22
- package/lib/chevre/service/task.js +8 -40
- 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 +8 -4
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +55 -103
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +2 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +14 -10
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.d.ts +13 -3
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +48 -51
- package/lib/chevre/service/transaction/returnOrder.d.ts +2 -0
- package/lib/chevre/service/transaction/returnOrder.js +15 -13
- package/lib/chevre/service/transaction.d.ts +2 -0
- package/lib/chevre/service/transaction.js +0 -2
- 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/checkThing.d.ts +0 -8
- package/lib/chevre/repo/action/checkThing.js +0 -13
- 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/service/validation/validateEvent.d.ts +0 -11
- package/lib/chevre/service/validation/validateEvent.js +0 -21
|
@@ -213,14 +213,14 @@ function createRefundPurpose(params, order) {
|
|
|
213
213
|
}
|
|
214
214
|
function refundTransactionAlreadyExists(params) {
|
|
215
215
|
return async (repos) => {
|
|
216
|
-
const refundTransactions = await repos.assetTransaction.
|
|
216
|
+
const refundTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
217
217
|
limit: 1,
|
|
218
218
|
page: 1,
|
|
219
219
|
project: { id: { $eq: params.project.id } },
|
|
220
220
|
typeOf: factory_1.factory.assetTransactionType.Refund,
|
|
221
221
|
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
222
222
|
object: { paymentMethodId: { $eq: params.object.paymentMethodId } }
|
|
223
|
-
}, ['_id']
|
|
223
|
+
}, ['_id']);
|
|
224
224
|
return refundTransactions.length > 0;
|
|
225
225
|
};
|
|
226
226
|
}
|
|
@@ -293,8 +293,6 @@ function onRefund(params) {
|
|
|
293
293
|
const simpleOrder = {
|
|
294
294
|
typeOf: order.typeOf,
|
|
295
295
|
orderNumber: order.orderNumber,
|
|
296
|
-
// price: order.price,
|
|
297
|
-
// priceCurrency: order.priceCurrency,
|
|
298
296
|
orderDate: order.orderDate
|
|
299
297
|
};
|
|
300
298
|
sendEmailMessageByPotentialActions.forEach((s) => {
|
|
@@ -303,7 +301,6 @@ function onRefund(params) {
|
|
|
303
301
|
typeOf: factory_1.factory.actionType.SendAction,
|
|
304
302
|
object: s.object,
|
|
305
303
|
agent: refundActionAttributes.project,
|
|
306
|
-
recipient: { typeOf: order.customer.typeOf, id: order.customer.id },
|
|
307
304
|
purpose: simpleOrder
|
|
308
305
|
};
|
|
309
306
|
const sendEmailMessageTask = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
|
-
const
|
|
4
|
+
const sendEmailMessage_1 = require("../../repo/action/sendEmailMessage");
|
|
5
5
|
const message_1 = require("../../repo/message");
|
|
6
6
|
const project_1 = require("../../repo/project");
|
|
7
7
|
const integration_1 = require("../../repo/setting/integration");
|
|
@@ -15,7 +15,7 @@ function call(params) {
|
|
|
15
15
|
...params.data.actionAttributes,
|
|
16
16
|
sameAs: { id: params.id } // タスクIDを関連付け(2024-06-25~)
|
|
17
17
|
})({
|
|
18
|
-
|
|
18
|
+
actions: { sendEmailMessage: new sendEmailMessage_1.SendEmailMessageActionRepo(connection) },
|
|
19
19
|
message: new message_1.MessageRepo(connection),
|
|
20
20
|
project: new project_1.ProjectRepo(connection),
|
|
21
21
|
integrationSetting: new integration_1.IntegrationSettingRepo({ connection })
|
|
@@ -3,20 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
5
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
6
|
-
const
|
|
6
|
+
const sendOrder_1 = require("../../repo/action/sendOrder");
|
|
7
7
|
const order_1 = require("../../repo/order");
|
|
8
|
-
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
9
8
|
const setting_1 = require("../../repo/setting");
|
|
10
9
|
const task_1 = require("../../repo/task");
|
|
11
|
-
const
|
|
12
|
-
const sendOrder_1 = require("../order/sendOrder");
|
|
10
|
+
const sendOrder_2 = require("../order/sendOrder");
|
|
13
11
|
/**
|
|
14
12
|
* タスク実行関数
|
|
15
13
|
*/
|
|
16
14
|
function call(params) {
|
|
17
15
|
return async ({ connection }) => {
|
|
18
16
|
const { data } = params;
|
|
19
|
-
await (0,
|
|
17
|
+
await (0, sendOrder_2.sendOrder)({
|
|
20
18
|
...data,
|
|
21
19
|
object: {
|
|
22
20
|
...data.object,
|
|
@@ -30,12 +28,10 @@ function call(params) {
|
|
|
30
28
|
useOnOrderStatusChanged: true
|
|
31
29
|
})({
|
|
32
30
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
33
|
-
|
|
31
|
+
actions: { sendOrder: new sendOrder_1.SendOrderActionRepo(connection) },
|
|
34
32
|
order: new order_1.OrderRepo(connection),
|
|
35
|
-
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
36
33
|
setting: new setting_1.SettingRepo(connection),
|
|
37
34
|
task: new task_1.TaskRepo(connection),
|
|
38
|
-
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
|
39
35
|
});
|
|
40
36
|
};
|
|
41
37
|
}
|
|
@@ -7,7 +7,7 @@ exports.call = call;
|
|
|
7
7
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
8
8
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
9
|
const factory_1 = require("../../factory");
|
|
10
|
-
const
|
|
10
|
+
const update_1 = require("../../repo/action/update");
|
|
11
11
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
12
12
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
13
13
|
const credentials_1 = require("../../repo/credentials");
|
|
@@ -24,14 +24,10 @@ let coaAuthClient;
|
|
|
24
24
|
* タスク実行関数
|
|
25
25
|
*/
|
|
26
26
|
function call(params) {
|
|
27
|
-
return async ({ connection, redisClient }
|
|
27
|
+
return async ({ connection, redisClient }) => {
|
|
28
28
|
if (redisClient === undefined) {
|
|
29
29
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
30
30
|
}
|
|
31
|
-
// 遅延実行(executeByName)には対応しない
|
|
32
|
-
if (!options.executeById) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
31
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
36
32
|
const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
|
|
37
33
|
const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
@@ -57,21 +53,22 @@ function call(params) {
|
|
|
57
53
|
...(credentialsRepo !== undefined) ? { credentialsRepo } : undefined
|
|
58
54
|
});
|
|
59
55
|
}
|
|
60
|
-
const
|
|
56
|
+
const updateActionRepo = new update_1.UpdateActionRepo(connection);
|
|
61
57
|
try {
|
|
62
58
|
const masterService = new coa_service_1.COA.service.Master({
|
|
63
59
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
64
60
|
auth: coaAuthClient
|
|
65
61
|
}, { timeout: (await settings.getByKey('coa')).timeoutMaster });
|
|
66
|
-
const {
|
|
62
|
+
const { object } = params.data;
|
|
67
63
|
if (object.typeOf === factory_1.factory.eventType.ScreeningEventSeries) {
|
|
68
64
|
await syncEventSeries({
|
|
69
65
|
project: { id: params.project.id },
|
|
70
|
-
agent,
|
|
71
66
|
object,
|
|
72
67
|
sameAs: { id: params.id }
|
|
73
68
|
})({
|
|
74
|
-
|
|
69
|
+
actions: {
|
|
70
|
+
update: updateActionRepo
|
|
71
|
+
},
|
|
75
72
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
76
73
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
77
74
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
@@ -82,11 +79,12 @@ function call(params) {
|
|
|
82
79
|
else if (object.typeOf === factory_1.factory.eventType.ScreeningEvent) {
|
|
83
80
|
await syncEvents({
|
|
84
81
|
project: { id: params.project.id },
|
|
85
|
-
agent,
|
|
86
82
|
object,
|
|
87
83
|
sameAs: { id: params.id }
|
|
88
84
|
})({
|
|
89
|
-
|
|
85
|
+
actions: {
|
|
86
|
+
update: updateActionRepo
|
|
87
|
+
},
|
|
90
88
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
91
89
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
92
90
|
event: new event_1.EventRepo(connection),
|
|
@@ -100,7 +98,7 @@ function call(params) {
|
|
|
100
98
|
catch (error) {
|
|
101
99
|
let throwsError = true;
|
|
102
100
|
// アクションが存在すればタスクを実行済扱いにする
|
|
103
|
-
const action = (await
|
|
101
|
+
const action = (await updateActionRepo.findUpdateActionsBySameAs({
|
|
104
102
|
sameAs: { id: { $eq: params.id } },
|
|
105
103
|
typeOf: { $eq: factory_1.factory.actionType.ReplaceAction }
|
|
106
104
|
})).shift();
|
|
@@ -119,21 +117,26 @@ function call(params) {
|
|
|
119
117
|
function syncEventSeries(params) {
|
|
120
118
|
return async (repos) => {
|
|
121
119
|
const { locationBranchCode, titleBranchNum, titleCode } = params.object;
|
|
120
|
+
const instrument = {
|
|
121
|
+
theaterCode: params.object.locationBranchCode,
|
|
122
|
+
typeOf: 'WebAPI',
|
|
123
|
+
identifier: factory_1.factory.service.webAPI.Identifier.COA
|
|
124
|
+
};
|
|
122
125
|
const actionAttributes = {
|
|
123
126
|
project: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
124
127
|
typeOf: factory_1.factory.actionType.ReplaceAction,
|
|
125
|
-
agent: params.
|
|
128
|
+
agent: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
126
129
|
// eslint-disable-next-line no-warning-comments
|
|
127
130
|
// TODO define object
|
|
128
131
|
object: {
|
|
129
132
|
...params.object,
|
|
130
133
|
typeOf: factory_1.factory.eventType.ScreeningEventSeries
|
|
131
134
|
}, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
132
|
-
|
|
135
|
+
instrument,
|
|
133
136
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEventSeries },
|
|
134
137
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' }
|
|
135
138
|
};
|
|
136
|
-
const action = await repos.
|
|
139
|
+
const action = await repos.actions.update.startUpdateAction(actionAttributes);
|
|
137
140
|
let saveResult;
|
|
138
141
|
try {
|
|
139
142
|
const movieTheater = (await repos.movieTheater.projectFields({
|
|
@@ -169,7 +172,7 @@ function syncEventSeries(params) {
|
|
|
169
172
|
}
|
|
170
173
|
catch (error) {
|
|
171
174
|
try {
|
|
172
|
-
await repos.
|
|
175
|
+
await repos.actions.update.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
173
176
|
}
|
|
174
177
|
catch (__) {
|
|
175
178
|
// no op
|
|
@@ -182,27 +185,32 @@ function syncEventSeries(params) {
|
|
|
182
185
|
typeOf: eventSeries.typeOf
|
|
183
186
|
};
|
|
184
187
|
});
|
|
185
|
-
await repos.
|
|
188
|
+
await repos.actions.update.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result });
|
|
186
189
|
};
|
|
187
190
|
}
|
|
188
191
|
function syncEvents(params) {
|
|
189
192
|
return async (repos) => {
|
|
190
193
|
const { locationBranchCode, titleBranchNum, titleCode, roomCode, startDate } = params.object;
|
|
194
|
+
const instrument = {
|
|
195
|
+
theaterCode: params.object.locationBranchCode,
|
|
196
|
+
typeOf: 'WebAPI',
|
|
197
|
+
identifier: factory_1.factory.service.webAPI.Identifier.COA
|
|
198
|
+
};
|
|
191
199
|
const actionAttributes = {
|
|
192
200
|
project: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
193
201
|
typeOf: factory_1.factory.actionType.ReplaceAction,
|
|
194
|
-
agent: params.
|
|
202
|
+
agent: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
195
203
|
// eslint-disable-next-line no-warning-comments
|
|
196
204
|
// TODO define object
|
|
197
205
|
object: {
|
|
198
206
|
...params.object,
|
|
199
207
|
typeOf: factory_1.factory.eventType.ScreeningEvent
|
|
200
208
|
}, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
201
|
-
|
|
209
|
+
instrument,
|
|
202
210
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEvent },
|
|
203
211
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' }
|
|
204
212
|
};
|
|
205
|
-
const action = await repos.
|
|
213
|
+
const action = await repos.actions.update.startUpdateAction(actionAttributes);
|
|
206
214
|
let saveResult;
|
|
207
215
|
try {
|
|
208
216
|
const movieTheater = (await repos.movieTheater.projectFields({
|
|
@@ -284,7 +292,7 @@ function syncEvents(params) {
|
|
|
284
292
|
}
|
|
285
293
|
catch (error) {
|
|
286
294
|
try {
|
|
287
|
-
await repos.
|
|
295
|
+
await repos.actions.update.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
288
296
|
}
|
|
289
297
|
catch (__) {
|
|
290
298
|
// no op
|
|
@@ -297,6 +305,6 @@ function syncEvents(params) {
|
|
|
297
305
|
typeOf: event.typeOf
|
|
298
306
|
};
|
|
299
307
|
});
|
|
300
|
-
await repos.
|
|
308
|
+
await repos.actions.update.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result });
|
|
301
309
|
};
|
|
302
310
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
|
-
const
|
|
4
|
+
const inform_1 = require("../../repo/action/inform");
|
|
5
5
|
const potentialAction_1 = require("../../repo/potentialAction");
|
|
6
6
|
const setting_1 = require("../../repo/setting");
|
|
7
7
|
const notification_1 = require("../notification");
|
|
@@ -14,7 +14,9 @@ function call(params) {
|
|
|
14
14
|
...params.data,
|
|
15
15
|
project: { id: params.project.id }
|
|
16
16
|
})({
|
|
17
|
-
|
|
17
|
+
actions: {
|
|
18
|
+
inform: new inform_1.InformActionRepo(connection)
|
|
19
|
+
},
|
|
18
20
|
potentialAction: new potentialAction_1.PotentialActionRepo(connection),
|
|
19
21
|
setting: new setting_1.SettingRepo(connection)
|
|
20
22
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const action_1 = require("../../repo/action");
|
|
5
|
+
const use_1 = require("../../repo/action/use");
|
|
5
6
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
7
|
const authorization_1 = require("../../repo/authorization");
|
|
7
8
|
const order_1 = require("../../repo/order");
|
|
@@ -23,6 +24,9 @@ function call(params) {
|
|
|
23
24
|
...(typeof data.location?.identifier === 'string') ? { location: data.location } : undefined
|
|
24
25
|
})({
|
|
25
26
|
action: new action_1.ActionRepo(connection),
|
|
27
|
+
actions: {
|
|
28
|
+
use: new use_1.UseActionRepo(connection)
|
|
29
|
+
},
|
|
26
30
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
27
31
|
code: new authorization_1.AuthorizationRepo(connection),
|
|
28
32
|
order: new order_1.OrderRepo(connection),
|
|
@@ -16,7 +16,6 @@ const setting_1 = require("../../repo/setting");
|
|
|
16
16
|
const integration_1 = require("../../repo/setting/integration");
|
|
17
17
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
18
18
|
const task_1 = require("../../repo/task");
|
|
19
|
-
// import { TransactionRepo } from '../../repo/transaction';
|
|
20
19
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
21
20
|
let coaAuthClientCreated = false;
|
|
22
21
|
let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
@@ -28,16 +27,16 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
|
28
27
|
* タスク実行関数
|
|
29
28
|
*/
|
|
30
29
|
function call(params) {
|
|
31
|
-
return async ({ connection, redisClient }
|
|
30
|
+
return async ({ connection, redisClient }) => {
|
|
32
31
|
if (redisClient === undefined) {
|
|
33
32
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
34
33
|
}
|
|
35
34
|
const voidByActionId = typeof params.data.id === 'string';
|
|
36
35
|
if (voidByActionId) {
|
|
37
|
-
// 遅延実行(executeByName)には対応しない
|
|
38
|
-
if (!options.executeById) {
|
|
39
|
-
|
|
40
|
-
}
|
|
36
|
+
// // 遅延実行(executeByName)には対応しない
|
|
37
|
+
// if (!options.executeById) {
|
|
38
|
+
// return;
|
|
39
|
+
// }
|
|
41
40
|
}
|
|
42
41
|
if (!coaAuthClientCreated) {
|
|
43
42
|
const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
|
|
@@ -53,7 +52,6 @@ function call(params) {
|
|
|
53
52
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
54
53
|
auth: coaAuthClient
|
|
55
54
|
}, { timeout: (await settings.getByKey('coa')).timeoutReserve });
|
|
56
|
-
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
57
55
|
try {
|
|
58
56
|
await (0, voidTransaction_1.voidTransaction)({
|
|
59
57
|
...params.data,
|
|
@@ -71,7 +69,6 @@ function call(params) {
|
|
|
71
69
|
setting: new setting_1.SettingRepo(connection),
|
|
72
70
|
task: new task_1.TaskRepo(connection),
|
|
73
71
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
74
|
-
// transaction: new TransactionRepo(connection),
|
|
75
72
|
reserveService
|
|
76
73
|
}, settings);
|
|
77
74
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { IExecuteSettings as IMinimumExecuteSettings,
|
|
2
|
-
import { factory } from '../factory';
|
|
1
|
+
import type { IExecuteSettings as IMinimumExecuteSettings, IReadyTask, IRunningTask } from '../eventEmitter/task';
|
|
3
2
|
import type { AggregationSettings } from '../taskSettings';
|
|
4
3
|
interface IExecuteSettings extends IMinimumExecuteSettings {
|
|
5
4
|
aggregationSettings?: AggregationSettings;
|
|
@@ -8,30 +7,12 @@ type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
|
8
7
|
/**
|
|
9
8
|
* タスク変更イベントを受けて実行する
|
|
10
9
|
*/
|
|
11
|
-
declare function
|
|
10
|
+
declare function executeTaskById(params: (Pick<IReadyTask, 'id' | 'status'> | Pick<IRunningTask, 'id' | 'status'>) & {
|
|
12
11
|
executor: {
|
|
13
12
|
/**
|
|
14
13
|
* タスク実行者名称
|
|
15
14
|
*/
|
|
16
15
|
name: string;
|
|
17
16
|
};
|
|
18
|
-
}, next?: INextFunction): IOperation<void>;
|
|
19
|
-
declare function executeOneIfExists(params: {
|
|
20
|
-
name: {
|
|
21
|
-
$eq: factory.taskName;
|
|
22
|
-
};
|
|
23
|
-
executor: {
|
|
24
|
-
/**
|
|
25
|
-
* タスク実行者名称
|
|
26
|
-
*/
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
29
|
-
runsAt: {
|
|
30
|
-
$lt: Date;
|
|
31
|
-
};
|
|
32
|
-
sort: {
|
|
33
|
-
numberOfTried?: factory.sortType;
|
|
34
|
-
runsAt?: factory.sortType;
|
|
35
|
-
};
|
|
36
17
|
}): IOperation<void>;
|
|
37
|
-
export {
|
|
18
|
+
export { executeTaskById };
|
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.executeOneIfExists = executeOneIfExists;
|
|
6
|
+
exports.executeTaskById = executeTaskById;
|
|
8
7
|
/**
|
|
9
8
|
* タスクサービス
|
|
10
9
|
*/
|
|
@@ -14,57 +13,26 @@ const debug = (0, debug_1.default)('chevre-domain:service:task');
|
|
|
14
13
|
/**
|
|
15
14
|
* タスク変更イベントを受けて実行する
|
|
16
15
|
*/
|
|
17
|
-
function
|
|
16
|
+
function executeTaskById(params) {
|
|
18
17
|
return async (settings) => {
|
|
19
|
-
const
|
|
20
|
-
const { id, status, executor
|
|
18
|
+
const taskRunningRepo = new (await import('../repo/taskRunning.js')).TaskRunningRepo(settings.connection);
|
|
19
|
+
const { id, status, executor } = params;
|
|
21
20
|
let task = null;
|
|
22
21
|
try {
|
|
23
22
|
// support status: Running(2025-03-05~)
|
|
24
|
-
task = await
|
|
23
|
+
task = await taskRunningRepo.executeOneById({
|
|
25
24
|
id,
|
|
26
25
|
status,
|
|
27
|
-
executor: { name: executor.name }
|
|
28
|
-
...(expires instanceof Date) ? { expires } : undefined
|
|
26
|
+
executor: { name: executor.name }
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
catch (error) {
|
|
32
30
|
/* istanbul ignore next */
|
|
33
|
-
debug('service.task.
|
|
31
|
+
debug('service.task.executeTaskById error:', error);
|
|
34
32
|
}
|
|
35
33
|
// タスクがなければ終了
|
|
36
34
|
if (task !== null) {
|
|
37
|
-
await (0, taskHandler_1.executeTask)(task
|
|
38
|
-
executeById: true,
|
|
39
|
-
executeByName: false
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function executeOneIfExists(params) {
|
|
45
|
-
return async (settings) => {
|
|
46
|
-
const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
|
|
47
|
-
// 未実行のタスクを取得
|
|
48
|
-
let task = null;
|
|
49
|
-
try {
|
|
50
|
-
task = await taskRepo.executeOneIfExists({
|
|
51
|
-
executor: { name: params.executor.name },
|
|
52
|
-
runsAt: { $lt: params.runsAt.$lt },
|
|
53
|
-
name: params.name,
|
|
54
|
-
sort: params.sort
|
|
55
|
-
});
|
|
56
|
-
debug('executable task found.', task, params.runsAt.$lt);
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
/* istanbul ignore next */
|
|
60
|
-
debug('executeOne error:', error);
|
|
61
|
-
}
|
|
62
|
-
// タスクがなければ終了
|
|
63
|
-
if (task !== null) {
|
|
64
|
-
await (0, taskHandler_1.executeTask)(task)(settings, {
|
|
65
|
-
executeById: false,
|
|
66
|
-
executeByName: (typeof params.name?.$eq === 'string')
|
|
67
|
-
});
|
|
35
|
+
await (0, taskHandler_1.executeTask)(task)(settings, {});
|
|
68
36
|
}
|
|
69
37
|
};
|
|
70
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { INextFunction } from '../../eventEmitter/task';
|
|
2
1
|
import { factory } from '../../factory';
|
|
3
2
|
import type { SettingRepo } from '../../repo/setting';
|
|
4
3
|
import type { TaskRepo } from '../../repo/task';
|
|
4
|
+
import type { TaskRunningRepo } from '../../repo/taskRunning';
|
|
5
5
|
import type { IExecutableTask } from '../../taskSettings';
|
|
6
6
|
/**
|
|
7
7
|
* タスク実行失敗時処理
|
|
@@ -10,9 +10,10 @@ declare function onOperationFailed(params: {
|
|
|
10
10
|
task: IExecutableTask<factory.taskName>;
|
|
11
11
|
now: Date;
|
|
12
12
|
error: any;
|
|
13
|
-
next?:
|
|
13
|
+
next?: never;
|
|
14
14
|
}): (repos: {
|
|
15
15
|
setting: SettingRepo;
|
|
16
16
|
task: TaskRepo;
|
|
17
|
+
taskRunning: TaskRunningRepo;
|
|
17
18
|
}) => Promise<void>;
|
|
18
19
|
export { onOperationFailed };
|
|
@@ -9,7 +9,7 @@ const informTaskIfNeeded_1 = require("./onOperationFailed/informTaskIfNeeded");
|
|
|
9
9
|
function onOperationFailed(params) {
|
|
10
10
|
return async (repos) => {
|
|
11
11
|
let error = params.error;
|
|
12
|
-
const { task, now
|
|
12
|
+
const { task, now } = params;
|
|
13
13
|
if (error === null || typeof error !== 'object') {
|
|
14
14
|
error = { message: String(error) };
|
|
15
15
|
}
|
|
@@ -18,9 +18,6 @@ function onOperationFailed(params) {
|
|
|
18
18
|
const isRetryable = task.remainingNumberOfTries > 0;
|
|
19
19
|
if (isRetryable) {
|
|
20
20
|
// 実験的に実行中タスク連携をしてみたが、ひとまず廃止(2026-07-01~)
|
|
21
|
-
// if (USE_INFORM_TASK_RUNNING) {
|
|
22
|
-
// await informTaskIfNeeded({ task, executionEndDate: endDate })(repos);
|
|
23
|
-
// }
|
|
24
21
|
const result = {
|
|
25
22
|
executedAt: now,
|
|
26
23
|
endDate,
|
|
@@ -33,14 +30,10 @@ function onOperationFailed(params) {
|
|
|
33
30
|
}
|
|
34
31
|
};
|
|
35
32
|
// 失敗してもここではステータスを戻さない(Runningのまま待機)
|
|
36
|
-
await repos.
|
|
37
|
-
id: task.id,
|
|
38
|
-
remainingNumberOfTries: task.remainingNumberOfTries,
|
|
39
|
-
name: task.name
|
|
40
|
-
}, {
|
|
33
|
+
await repos.taskRunning.setExecutionResultAndStatus({ id: task.id }, {
|
|
41
34
|
status: task.status,
|
|
42
35
|
executionResult: result
|
|
43
|
-
}
|
|
36
|
+
});
|
|
44
37
|
}
|
|
45
38
|
else {
|
|
46
39
|
// 分析連携(2025-08-05~)
|
|
@@ -59,14 +52,10 @@ function onOperationFailed(params) {
|
|
|
59
52
|
stack: error.stack
|
|
60
53
|
}
|
|
61
54
|
};
|
|
62
|
-
await repos.
|
|
63
|
-
id: task.id,
|
|
64
|
-
remainingNumberOfTries: task.remainingNumberOfTries,
|
|
65
|
-
name: task.name
|
|
66
|
-
}, {
|
|
55
|
+
await repos.taskRunning.setExecutionResultAndStatus({ id: task.id }, {
|
|
67
56
|
status: factory_1.factory.taskStatus.Aborted,
|
|
68
57
|
executionResult: result
|
|
69
|
-
}
|
|
58
|
+
});
|
|
70
59
|
}
|
|
71
60
|
};
|
|
72
61
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { INextFunction } from '../eventEmitter/task';
|
|
2
1
|
import { factory } from '../factory';
|
|
3
2
|
import type { ICallResult, ICallableTaskOperation, IExecutableTask, IExecutableTaskKeys, IOperationExecute } from '../taskSettings';
|
|
4
3
|
export declare const taskLoader: {
|
|
@@ -9,5 +8,5 @@ export declare const taskLoader: {
|
|
|
9
8
|
/**
|
|
10
9
|
* タスクを実行する
|
|
11
10
|
*/
|
|
12
|
-
declare function executeTask(task: IExecutableTask<factory.taskName
|
|
11
|
+
declare function executeTask(task: IExecutableTask<factory.taskName>): IOperationExecute<void>;
|
|
13
12
|
export { ICallableTaskOperation, ICallResult, IExecutableTaskKeys, IOperationExecute, executeTask };
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.taskLoader = void 0;
|
|
7
7
|
exports.executeTask = executeTask;
|
|
8
8
|
const debug_1 = __importDefault(require("debug"));
|
|
9
|
-
const moment_1 = __importDefault(require("moment"));
|
|
10
9
|
const factory_1 = require("../factory");
|
|
11
10
|
const onOperationFailed_1 = require("./taskHandler/onOperationFailed");
|
|
12
11
|
const debug = (0, debug_1.default)('chevre-domain:service:taskHandler');
|
|
@@ -18,21 +17,15 @@ exports.taskLoader = {
|
|
|
18
17
|
/**
|
|
19
18
|
* タスクを実行する
|
|
20
19
|
*/
|
|
21
|
-
function executeTask(task
|
|
20
|
+
function executeTask(task) {
|
|
22
21
|
const now = new Date();
|
|
23
22
|
debug('executing an executableTask...', task, now);
|
|
24
23
|
return async (settings, options) => {
|
|
25
24
|
const settingRepo = new (await import('../repo/setting.js')).SettingRepo(settings.connection);
|
|
26
25
|
const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
|
|
26
|
+
const taskRunningRepo = new (await import('../repo/taskRunning.js')).TaskRunningRepo(settings.connection);
|
|
27
27
|
try {
|
|
28
|
-
//
|
|
29
|
-
if (task.expires instanceof Date) {
|
|
30
|
-
const taskExpired = (0, moment_1.default)(now)
|
|
31
|
-
.isAfter(task.expires);
|
|
32
|
-
if (taskExpired) {
|
|
33
|
-
throw new factory_1.factory.errors.Internal(`task expired [expires:${task.expires}]`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
28
|
+
// タスクのexpiresは廃止済なので期限検証はなし(2026-08-07~)
|
|
36
29
|
// remainingNumberOfTries<0ならcallを実行しない(2025-08-04~)
|
|
37
30
|
// リトライを繰り返した後、不明の原因でRunningのまま残ってしまったタスクがリトライされたケース
|
|
38
31
|
const { remainingNumberOfTries } = task;
|
|
@@ -55,20 +48,15 @@ function executeTask(task, next) {
|
|
|
55
48
|
}
|
|
56
49
|
: ''
|
|
57
50
|
};
|
|
58
|
-
await
|
|
59
|
-
id: task.id,
|
|
60
|
-
remainingNumberOfTries,
|
|
61
|
-
name: task.name
|
|
62
|
-
}, {
|
|
51
|
+
await taskRunningRepo.setExecutionResultAndStatus({ id: task.id }, {
|
|
63
52
|
status: factory_1.factory.taskStatus.Executed,
|
|
64
53
|
executionResult: result
|
|
65
|
-
}
|
|
54
|
+
});
|
|
66
55
|
}
|
|
67
56
|
catch (error) {
|
|
68
57
|
await (0, onOperationFailed_1.onOperationFailed)({
|
|
69
|
-
task, now, error
|
|
70
|
-
|
|
71
|
-
})({ setting: settingRepo, task: taskRepo });
|
|
58
|
+
task, now, error
|
|
59
|
+
})({ setting: settingRepo, task: taskRepo, taskRunning: taskRunningRepo });
|
|
72
60
|
}
|
|
73
61
|
};
|
|
74
62
|
}
|
package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js
CHANGED
|
@@ -29,10 +29,10 @@ function deletePayTransactionsByPlaceOrder(params) {
|
|
|
29
29
|
deletedCount: deleteAssetTransactionsResult?.deletedCount
|
|
30
30
|
};
|
|
31
31
|
// 返金取引も削除(2023-05-19~)
|
|
32
|
-
const refundTransactions = await repos.assetTransaction.
|
|
32
|
+
const refundTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
33
33
|
typeOf: factory_1.factory.assetTransactionType.Refund,
|
|
34
34
|
object: { paymentMethodId: { $in: payTransactionNumbers } }
|
|
35
|
-
}, ['transactionNumber']
|
|
35
|
+
}, ['transactionNumber']);
|
|
36
36
|
if (refundTransactions.length > 0) {
|
|
37
37
|
const deleteRefundAssetTransactionsResult = await repos.assetTransaction.deleteByTransactionNumber({
|
|
38
38
|
project: { id: params.transaction.project.id },
|
|
@@ -40,11 +40,11 @@ function deleteReservationsByPlaceOrder(params) {
|
|
|
40
40
|
deletedCount: deleteAssetTransactionsResult?.deletedCount
|
|
41
41
|
};
|
|
42
42
|
// 予約番号で予約取消取引を検索
|
|
43
|
-
const deletingCancelReservationTransactions = await repos.assetTransaction.
|
|
43
|
+
const deletingCancelReservationTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
44
44
|
project: { id: { $eq: params.transaction.project.id } },
|
|
45
45
|
object: { reservationNumber: { $in: reserveTransactionNumbers } },
|
|
46
46
|
typeOf: factory_1.factory.assetTransactionType.CancelReservation
|
|
47
|
-
}, ['transactionNumber']
|
|
47
|
+
}, ['transactionNumber']);
|
|
48
48
|
if (deletingCancelReservationTransactions.length > 0) {
|
|
49
49
|
// 予約取消取引も削除(2024-04-18~)
|
|
50
50
|
const deleteCancelReservationResult = await repos.assetTransaction.deleteByTransactionNumber({
|