@chevre/domain 26.0.0-alpha.2 → 26.0.0-alpha.21
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/adminAsyncAction.d.ts +2 -2
- package/lib/chevre/repo/adminScheduledTask.d.ts +1 -1
- package/lib/chevre/repo/adminTask.d.ts +31 -8
- package/lib/chevre/repo/adminTask.js +41 -26
- package/lib/chevre/repo/aggregateScheduledTask.d.ts +32 -0
- package/lib/chevre/repo/aggregateScheduledTask.js +136 -0
- package/lib/chevre/repo/asyncAction.d.ts +2 -2
- 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 +87 -96
- 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 +25 -172
- package/lib/chevre/repo/task.js +19 -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/repository.d.ts +10 -0
- package/lib/chevre/repository.js +24 -2
- package/lib/chevre/service/aggregation/system.d.ts +10 -2
- package/lib/chevre/service/aggregation/system.js +42 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +5 -25
- 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/offer/eventServiceByCOA/authorize/factory.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +0 -4
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +19 -19
- package/lib/chevre/service/order/confirmPayTransaction.js +4 -1
- 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 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- 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/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/publishPaymentUrl.d.ts +0 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -2
- package/lib/chevre/service/project.d.ts +0 -3
- package/lib/chevre/service/project.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
- 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/confirmReserveTransaction.js +3 -1
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +4 -1
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -1
- package/lib/chevre/service/task/importOffersFromCOA.js +5 -5
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -13
- package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -5
- 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.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 -53
- 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/taskSettings.d.ts +4 -4
- package/package.json +2 -2
|
@@ -5,11 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.taskLoader = void 0;
|
|
7
7
|
exports.executeAsyncAction = executeAsyncAction;
|
|
8
|
-
const debug_1 = __importDefault(require("debug"));
|
|
9
8
|
const moment_1 = __importDefault(require("moment"));
|
|
10
9
|
const factory_1 = require("../factory");
|
|
11
10
|
const onOperationFailed_1 = require("./asyncActionHandler/onOperationFailed");
|
|
12
|
-
const debug = (0, debug_1.default)('chevre-domain:service:asyncActionHandler');
|
|
13
11
|
exports.taskLoader = {
|
|
14
12
|
load: (taskName) => {
|
|
15
13
|
return import(`./task/${taskName}.js`);
|
|
@@ -20,10 +18,9 @@ exports.taskLoader = {
|
|
|
20
18
|
*/
|
|
21
19
|
function executeAsyncAction(task, next) {
|
|
22
20
|
const now = new Date();
|
|
23
|
-
debug('executing an executableTask...', task, now);
|
|
24
21
|
return async (settings, options) => {
|
|
25
22
|
const asyncActionRepo = new (await import('../repo/asyncAction.js')).AsyncActionRepo(settings.connection);
|
|
26
|
-
let
|
|
23
|
+
let taskAsNextFunctionParam;
|
|
27
24
|
try {
|
|
28
25
|
// 期限検証(2024-04-23~)
|
|
29
26
|
if (task.expires instanceof Date) {
|
|
@@ -57,32 +54,33 @@ function executeAsyncAction(task, next) {
|
|
|
57
54
|
status: factory_1.factory.taskStatus.Executed,
|
|
58
55
|
executionResult: result
|
|
59
56
|
});
|
|
60
|
-
|
|
57
|
+
taskAsNextFunctionParam = {
|
|
61
58
|
id: task.id,
|
|
62
|
-
remainingNumberOfTries: 0, // one timeの前提なのでひとまず固定で0
|
|
63
59
|
name: task.name,
|
|
64
60
|
status: factory_1.factory.taskStatus.Executed,
|
|
65
|
-
executionResult: result
|
|
66
61
|
};
|
|
67
62
|
}
|
|
68
63
|
catch (error) {
|
|
69
64
|
const onOperationFailedResult = await (0, onOperationFailed_1.onOperationFailed)({
|
|
70
65
|
task, now, error,
|
|
71
66
|
})({ asyncAction: asyncActionRepo });
|
|
72
|
-
|
|
67
|
+
taskAsNextFunctionParam = {
|
|
68
|
+
id: onOperationFailedResult.executedTask.id,
|
|
69
|
+
name: onOperationFailedResult.executedTask.name,
|
|
70
|
+
status: onOperationFailedResult.executedTask.status
|
|
71
|
+
};
|
|
72
|
+
;
|
|
73
73
|
}
|
|
74
74
|
finally {
|
|
75
75
|
if (typeof next === 'function') {
|
|
76
|
-
if (
|
|
77
|
-
|
|
76
|
+
if (taskAsNextFunctionParam === undefined) {
|
|
77
|
+
taskAsNextFunctionParam = {
|
|
78
78
|
id: task.id,
|
|
79
|
-
remainingNumberOfTries: 0, // one timeの前提なのでひとまず固定で0
|
|
80
79
|
name: task.name,
|
|
81
80
|
status: factory_1.factory.taskStatus.Aborted,
|
|
82
|
-
executionResult: {} // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
83
81
|
};
|
|
84
82
|
}
|
|
85
|
-
await next(
|
|
83
|
+
await next(taskAsNextFunctionParam)(settings);
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
};
|
|
@@ -100,7 +100,7 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
100
100
|
name: event.superEvent.name,
|
|
101
101
|
alternativeHeadline: event.superEvent.alternativeHeadline,
|
|
102
102
|
location: event.superEvent.location,
|
|
103
|
-
soundFormat: event.superEvent.soundFormat,
|
|
103
|
+
// soundFormat: event.superEvent.soundFormat, // discontinue(2026-08-01~)
|
|
104
104
|
workPerformed: workPerformed,
|
|
105
105
|
duration: event.superEvent.duration,
|
|
106
106
|
coaInfo: event.superEvent.coaInfo
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
|
|
3
3
|
import type { AsyncActionRepo } from '../../../repo/asyncAction';
|
|
4
|
-
import type { TaskRepo } from '../../../repo/task';
|
|
5
4
|
interface IFindAcceptActionResult {
|
|
6
5
|
/**
|
|
7
6
|
* アクションID
|
|
@@ -35,11 +34,8 @@ declare function findAcceptAction(params: {
|
|
|
35
34
|
*/
|
|
36
35
|
id: string;
|
|
37
36
|
};
|
|
38
|
-
}, options: {
|
|
39
|
-
useAsyncAction: boolean;
|
|
40
37
|
}): (repos: {
|
|
41
38
|
action: AcceptCOAOfferActionRepo;
|
|
42
39
|
asyncAction: AsyncActionRepo;
|
|
43
|
-
task: TaskRepo;
|
|
44
40
|
}) => Promise<IFindAcceptActionResult>;
|
|
45
41
|
export { findAcceptAction };
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findAcceptAction = findAcceptAction;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
function findAcceptAction(params
|
|
5
|
+
function findAcceptAction(params) {
|
|
6
6
|
return async (repos) => {
|
|
7
7
|
// 非同期アクションに対応(2026-07-27~)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
8
|
+
// let task: Pick<factory.task.acceptCOAOffer.ITask, 'id' | 'status' | 'executionResults'> | undefined;
|
|
9
|
+
// まず非同期アクションを参照
|
|
10
|
+
const task = await repos.asyncAction.findAsyncActionById({
|
|
11
|
+
id: { $eq: params.sameAs.id },
|
|
12
|
+
project: { id: { $eq: params.project.id } },
|
|
13
|
+
name: factory_1.factory.taskName.AcceptCOAOffer
|
|
14
|
+
}, ['status', 'executionResults']);
|
|
15
|
+
// // 非同期アクションが存在しなければタスクを参照
|
|
16
|
+
// if (task === undefined) {
|
|
17
|
+
// task = await repos.task.findTaskById(
|
|
18
|
+
// {
|
|
19
|
+
// id: { $eq: params.sameAs.id },
|
|
20
|
+
// project: { id: { $eq: params.project.id } },
|
|
21
|
+
// name: factory.taskName.AcceptCOAOffer
|
|
22
|
+
// },
|
|
23
|
+
// ['status', 'executionResults']
|
|
24
|
+
// );
|
|
25
|
+
// }
|
|
26
26
|
if (task === undefined) {
|
|
27
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.AcceptCOAOffer);
|
|
28
28
|
}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.confirmPayTransaction = confirmPayTransaction;
|
|
37
|
+
const util_1 = require("util");
|
|
37
38
|
const factory_1 = require("../../factory");
|
|
38
39
|
// import type { TransactionRepo } from '../../repo/transaction';
|
|
39
40
|
const PayTransactionService = __importStar(require("../assetTransaction/pay"));
|
|
@@ -112,7 +113,9 @@ function onConfirmed(params) {
|
|
|
112
113
|
},
|
|
113
114
|
useOnOrderStatusChanged: params.useOnOrderStatusChanged === true
|
|
114
115
|
};
|
|
116
|
+
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s', params.project.id, factory_1.factory.taskName.OnAssetTransactionStatusChanged, onAssetTransactionStatusChangedTaskData.purpose.orderNumber, onAssetTransactionStatusChangedTaskData.object.transactionNumber);
|
|
115
117
|
const onAssetTransactionStatusChangedTask = {
|
|
118
|
+
identifier: taskIdentifier,
|
|
116
119
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
117
120
|
name: factory_1.factory.taskName.OnAssetTransactionStatusChanged,
|
|
118
121
|
status: factory_1.factory.taskStatus.Ready,
|
|
@@ -122,7 +125,7 @@ function onConfirmed(params) {
|
|
|
122
125
|
executionResults: [],
|
|
123
126
|
data: onAssetTransactionStatusChangedTaskData
|
|
124
127
|
};
|
|
125
|
-
await repos.task.
|
|
128
|
+
await repos.task.runTaskByIdentifier(onAssetTransactionStatusChangedTask);
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
};
|
|
@@ -62,7 +62,7 @@ function createSendOrderTaskIfNotExist(params) {
|
|
|
62
62
|
};
|
|
63
63
|
const taskIdentifier = `${sendOrderTaskData.project.id}:${factory_1.factory.taskName.SendOrder}:${sendOrderTaskData.object.typeOf}:${sendOrderTaskData.object.orderNumber}`;
|
|
64
64
|
const sendOrderTask = {
|
|
65
|
-
alternateName: taskIdentifier,
|
|
65
|
+
// alternateName: taskIdentifier,
|
|
66
66
|
identifier: taskIdentifier,
|
|
67
67
|
project: params.order.project,
|
|
68
68
|
name: factory_1.factory.taskName.SendOrder,
|
|
@@ -75,7 +75,7 @@ function createSendOrderTaskIfNotExist(params) {
|
|
|
75
75
|
};
|
|
76
76
|
debug('processing createSendOrderTaskIfNotExist...', sendOrderTask);
|
|
77
77
|
// await repos.task.createSendOrderTaskIfNotExist(sendOrderTask);
|
|
78
|
-
await repos.task.
|
|
78
|
+
await repos.task.runTaskByIdentifier(sendOrderTask);
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
function createOnAuthorizationCreatedTask(order) {
|
|
@@ -92,7 +92,7 @@ function createOnAuthorizationCreatedTask(order) {
|
|
|
92
92
|
const taskRunsAt = new Date();
|
|
93
93
|
const taskIdentifier = `${order.project.id}:${factory_1.factory.taskName.OnAuthorizationCreated}:${factory_1.factory.transactionType.PlaceOrder}:${placeOrderTransaction?.id}`;
|
|
94
94
|
const task = {
|
|
95
|
-
alternateName: taskIdentifier,
|
|
95
|
+
// alternateName: taskIdentifier,
|
|
96
96
|
identifier: taskIdentifier,
|
|
97
97
|
name: factory_1.factory.taskName.OnAuthorizationCreated,
|
|
98
98
|
status: factory_1.factory.taskStatus.Ready,
|
|
@@ -107,7 +107,7 @@ function createOnAuthorizationCreatedTask(order) {
|
|
|
107
107
|
},
|
|
108
108
|
project: { id: order.project.id, typeOf: factory_1.factory.organizationType.Project }
|
|
109
109
|
};
|
|
110
|
-
await repos.task.
|
|
110
|
+
await repos.task.runTaskByIdentifier(task);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
}
|
|
@@ -53,7 +53,7 @@ function createConfirmPayTransactionTasks(order, simpleOrder) {
|
|
|
53
53
|
};
|
|
54
54
|
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s:%s:%s', order.project.id, factory_1.factory.taskName.ConfirmPayTransaction, data.purpose.typeOf, data.purpose.orderNumber, factory_1.factory.assetTransactionType.Pay, invoice.paymentMethodId);
|
|
55
55
|
const confirmPayTransactionTask = {
|
|
56
|
-
alternateName: taskIdentifier,
|
|
56
|
+
// alternateName: taskIdentifier,
|
|
57
57
|
identifier: taskIdentifier,
|
|
58
58
|
project: order.project,
|
|
59
59
|
name: factory_1.factory.taskName.ConfirmPayTransaction,
|
|
@@ -64,7 +64,7 @@ function createConfirmPayTransactionTasks(order, simpleOrder) {
|
|
|
64
64
|
executionResults: [],
|
|
65
65
|
data
|
|
66
66
|
};
|
|
67
|
-
await repos.task.
|
|
67
|
+
await repos.task.runTaskByIdentifier(confirmPayTransactionTask);
|
|
68
68
|
// 冗長なタスク作成を回避
|
|
69
69
|
// const existingTasks = await repos.task.projectFields(
|
|
70
70
|
// {
|
|
@@ -48,7 +48,7 @@ function createSendEmailMessageTaskIfNotExist(params) {
|
|
|
48
48
|
purpose: simpleOrder
|
|
49
49
|
};
|
|
50
50
|
const sendEmailMessageTask = {
|
|
51
|
-
alternateName: taskIdentifier,
|
|
51
|
+
// alternateName: taskIdentifier,
|
|
52
52
|
identifier: taskIdentifier,
|
|
53
53
|
project: params.order.project,
|
|
54
54
|
name: factory_1.factory.taskName.SendEmailMessage,
|
|
@@ -59,7 +59,7 @@ function createSendEmailMessageTaskIfNotExist(params) {
|
|
|
59
59
|
executionResults: [],
|
|
60
60
|
data: { actionAttributes }
|
|
61
61
|
};
|
|
62
|
-
await repos.task.
|
|
62
|
+
await repos.task.runTaskByIdentifier(sendEmailMessageTask);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
@@ -5,8 +5,8 @@ type IProcessingOrder = Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'broke
|
|
|
5
5
|
numAcceptedOffers: number;
|
|
6
6
|
orderStatus: factory.orderStatus.OrderProcessing;
|
|
7
7
|
};
|
|
8
|
-
type ICreatingCheckResourceTask = Pick<factory.task.checkResource.IAttributes, '
|
|
9
|
-
alternateName
|
|
8
|
+
type ICreatingCheckResourceTask = Pick<factory.task.checkResource.IAttributes, 'data' | 'executionResults' | 'identifier' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'> & {
|
|
9
|
+
alternateName?: never;
|
|
10
10
|
identifier: string;
|
|
11
11
|
};
|
|
12
12
|
type ICreatingInformProcessingOrderTask = Pick<factory.task.IAttributes<factory.taskName.TriggerWebhook>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>;
|
|
@@ -142,7 +142,7 @@ function createCheckResourceTask(order) {
|
|
|
142
142
|
};
|
|
143
143
|
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s', order.project.id, factory_1.factory.taskName.CheckResource, order.typeOf, order.orderNumber);
|
|
144
144
|
return {
|
|
145
|
-
alternateName: taskIdentifier, // add identifier(2025-03-29~)
|
|
145
|
+
// alternateName: taskIdentifier, // add identifier(2025-03-29~)
|
|
146
146
|
identifier: taskIdentifier, // add identifier(2025-03-29~)
|
|
147
147
|
project: order.project,
|
|
148
148
|
name: factory_1.factory.taskName.CheckResource,
|
|
@@ -50,7 +50,7 @@ function createConfirmReserveTransactionTasksIfNotExist(order, simpleOrder, opti
|
|
|
50
50
|
};
|
|
51
51
|
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s:%s:%s', order.project.id, factory_1.factory.taskName.ConfirmReserveTransaction, data.purpose.typeOf, data.purpose.orderNumber, data.object.typeOf, data.object.transactionNumber);
|
|
52
52
|
const confirmReserveTransactionTask = {
|
|
53
|
-
alternateName: taskIdentifier,
|
|
53
|
+
// alternateName: taskIdentifier,
|
|
54
54
|
identifier: taskIdentifier,
|
|
55
55
|
project: order.project,
|
|
56
56
|
name: factory_1.factory.taskName.ConfirmReserveTransaction,
|
|
@@ -61,7 +61,7 @@ function createConfirmReserveTransactionTasksIfNotExist(order, simpleOrder, opti
|
|
|
61
61
|
executionResults: [],
|
|
62
62
|
data
|
|
63
63
|
};
|
|
64
|
-
await repos.task.
|
|
64
|
+
await repos.task.runTaskByIdentifier(confirmReserveTransactionTask);
|
|
65
65
|
if (options.force === true) {
|
|
66
66
|
const existingTask = await repos.task.findByIdentifier({
|
|
67
67
|
identifier: taskIdentifier,
|
|
@@ -37,7 +37,7 @@ function onOrderProcessing(params) {
|
|
|
37
37
|
await repos.task.saveMany(tasks);
|
|
38
38
|
// uniqueness of CheckResource task(2025-03-29~)
|
|
39
39
|
if (creatingCheckResourceTask !== undefined) {
|
|
40
|
-
await repos.task.
|
|
40
|
+
await repos.task.runTaskByIdentifier(creatingCheckResourceTask);
|
|
41
41
|
}
|
|
42
42
|
switch (params.order.orderStatus) {
|
|
43
43
|
case factory_1.factory.orderStatus.OrderProcessing:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { AcceptPayActionRepo } from '../../../repo/action/acceptPay';
|
|
3
3
|
import type { AsyncActionRepo } from '../../../repo/asyncAction';
|
|
4
|
-
import type { TaskRepo } from '../../../repo/task';
|
|
5
4
|
interface IFindAcceptActionResult {
|
|
6
5
|
/**
|
|
7
6
|
* アクションID
|
|
@@ -39,11 +38,8 @@ declare function findAcceptAction(params: {
|
|
|
39
38
|
*/
|
|
40
39
|
id: string;
|
|
41
40
|
};
|
|
42
|
-
}, options: {
|
|
43
|
-
useAsyncAction: boolean;
|
|
44
41
|
}): (repos: {
|
|
45
42
|
acceptPayAction: AcceptPayActionRepo;
|
|
46
43
|
asyncAction: AsyncActionRepo;
|
|
47
|
-
task: TaskRepo;
|
|
48
44
|
}) => Promise<IFindAcceptActionResult>;
|
|
49
45
|
export { findAcceptAction, };
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findAcceptAction = findAcceptAction;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
function findAcceptAction(params
|
|
5
|
+
function findAcceptAction(params) {
|
|
6
6
|
return async (repos) => {
|
|
7
7
|
// 非同期アクションに対応(2026-07-28~)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
8
|
+
// let task: Pick<factory.task.publishPaymentUrl.ITask, 'id' | 'status' | 'executionResults'> | undefined;
|
|
9
|
+
// まず非同期アクションを参照
|
|
10
|
+
const task = await repos.asyncAction.findAsyncActionById({
|
|
11
|
+
id: { $eq: params.sameAs.id },
|
|
12
|
+
project: { id: { $eq: params.project.id } },
|
|
13
|
+
name: factory_1.factory.taskName.PublishPaymentUrl
|
|
14
|
+
}, ['status', 'executionResults']);
|
|
15
|
+
// // 非同期アクションが存在しなければタスクを参照
|
|
16
|
+
// if (task === undefined) {
|
|
17
|
+
// task = await repos.task.findTaskById(
|
|
18
|
+
// {
|
|
19
|
+
// id: { $eq: params.sameAs.id },
|
|
20
|
+
// project: { id: { $eq: params.project.id } },
|
|
21
|
+
// name: factory.taskName.PublishPaymentUrl
|
|
22
|
+
// },
|
|
23
|
+
// ['status', 'executionResults']
|
|
24
|
+
// );
|
|
25
|
+
// }
|
|
26
26
|
if (task === undefined) {
|
|
27
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.PublishPaymentUrl);
|
|
28
28
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
|
|
3
3
|
import type { AsyncActionRepo } from '../../../repo/asyncAction';
|
|
4
|
-
import type { TaskRepo } from '../../../repo/task';
|
|
5
4
|
interface IFindAuthorizeActionResult {
|
|
6
5
|
/**
|
|
7
6
|
* アクションID
|
|
@@ -22,7 +21,6 @@ interface IFindAuthorizeActionResult {
|
|
|
22
21
|
interface IFindAuthorizeActionRepos {
|
|
23
22
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
24
23
|
asyncAction: AsyncActionRepo;
|
|
25
|
-
task: TaskRepo;
|
|
26
24
|
}
|
|
27
25
|
declare function findAuthorizeAction(params: {
|
|
28
26
|
project: {
|
|
@@ -40,7 +38,5 @@ declare function findAuthorizeAction(params: {
|
|
|
40
38
|
*/
|
|
41
39
|
id: string;
|
|
42
40
|
};
|
|
43
|
-
}, options: {
|
|
44
|
-
useAsyncAction: boolean;
|
|
45
41
|
}): (repos: IFindAuthorizeActionRepos) => Promise<IFindAuthorizeActionResult>;
|
|
46
42
|
export { IFindAuthorizeActionRepos, findAuthorizeAction, };
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findAuthorizeAction = findAuthorizeAction;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
function findAuthorizeAction(params
|
|
5
|
+
function findAuthorizeAction(params) {
|
|
6
6
|
return async (repos) => {
|
|
7
7
|
// 非同期アクションに対応(2026-07-28~)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
8
|
+
// let task: Pick<factory.task.authorizePayment.ITask, 'id' | 'status' | 'executionResults'> | undefined;
|
|
9
|
+
// まず非同期アクションを参照
|
|
10
|
+
const task = await repos.asyncAction.findAsyncActionById({
|
|
11
|
+
id: { $eq: params.sameAs.id },
|
|
12
|
+
project: { id: { $eq: params.project.id } },
|
|
13
|
+
name: factory_1.factory.taskName.AuthorizePayment
|
|
14
|
+
}, ['status', 'executionResults']);
|
|
15
|
+
// // 非同期アクションが存在しなければタスクを参照
|
|
16
|
+
// if (task === undefined) {
|
|
17
|
+
// task = await repos.task.findTaskById(
|
|
18
|
+
// {
|
|
19
|
+
// id: { $eq: params.sameAs.id },
|
|
20
|
+
// project: { id: { $eq: params.project.id } },
|
|
21
|
+
// name: factory.taskName.AuthorizePayment
|
|
22
|
+
// },
|
|
23
|
+
// ['status', 'executionResults']
|
|
24
|
+
// );
|
|
25
|
+
// }
|
|
26
26
|
if (task === undefined) {
|
|
27
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.AuthorizePayment);
|
|
28
28
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { CheckMovieTicketActionRepo, IMinimizedPurchaseNumberAuthResult } from '../../../repo/action/checkMovieTicket';
|
|
3
3
|
import type { AsyncActionRepo } from '../../../repo/asyncAction';
|
|
4
|
-
import type { TaskRepo } from '../../../repo/task';
|
|
5
4
|
interface IFindCheckActionRepos {
|
|
6
5
|
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
7
6
|
asyncAction: AsyncActionRepo;
|
|
8
|
-
task: TaskRepo;
|
|
9
7
|
}
|
|
10
8
|
interface IFindCheckActionResult {
|
|
11
9
|
/**
|
|
@@ -43,7 +41,5 @@ declare function findCheckAction(params: {
|
|
|
43
41
|
*/
|
|
44
42
|
id: string;
|
|
45
43
|
};
|
|
46
|
-
}, options: {
|
|
47
|
-
useAsyncAction: boolean;
|
|
48
44
|
}): (repos: IFindCheckActionRepos) => Promise<IFindCheckActionResult>;
|
|
49
45
|
export { IFindCheckActionRepos, findCheckAction, };
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findCheckAction = findCheckAction;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
function findCheckAction(params
|
|
5
|
+
function findCheckAction(params) {
|
|
6
6
|
return async (repos) => {
|
|
7
7
|
// 非同期アクションに対応(2026-07-28~)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
8
|
+
// let task: Pick<factory.task.checkMovieTicket.ITask, 'id' | 'status' | 'executionResults'> | undefined;
|
|
9
|
+
// まず非同期アクションを参照
|
|
10
|
+
const task = await repos.asyncAction.findAsyncActionById({
|
|
11
|
+
id: { $eq: params.sameAs.id },
|
|
12
|
+
project: { id: { $eq: params.project.id } },
|
|
13
|
+
name: factory_1.factory.taskName.CheckMovieTicket
|
|
14
|
+
}, ['status', 'executionResults']);
|
|
15
|
+
// // 非同期アクションが存在しなければタスクを参照
|
|
16
|
+
// if (task === undefined) {
|
|
17
|
+
// task = await repos.task.findTaskById(
|
|
18
|
+
// {
|
|
19
|
+
// id: { $eq: params.sameAs.id },
|
|
20
|
+
// project: { id: { $eq: params.project.id } },
|
|
21
|
+
// name: factory.taskName.CheckMovieTicket
|
|
22
|
+
// },
|
|
23
|
+
// ['status', 'executionResults']
|
|
24
|
+
// );
|
|
25
|
+
// }
|
|
26
26
|
if (task === undefined) {
|
|
27
27
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.CheckMovieTicket);
|
|
28
28
|
}
|
|
@@ -60,7 +60,5 @@ declare function publishPaymentUrl(params: {
|
|
|
60
60
|
*/
|
|
61
61
|
identifier?: string;
|
|
62
62
|
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
63
|
-
}, options: {
|
|
64
|
-
savePaymentMethodIdInTransaction: boolean;
|
|
65
63
|
}): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
|
|
66
64
|
export { IPublishPaymentUrlRepos, publishPaymentUrl };
|
|
@@ -41,7 +41,7 @@ const factory_2 = require("./factory");
|
|
|
41
41
|
/**
|
|
42
42
|
* 外部決済ロケーションを発行する
|
|
43
43
|
*/
|
|
44
|
-
function publishPaymentUrl(params
|
|
44
|
+
function publishPaymentUrl(params) {
|
|
45
45
|
return async (repos, settings) => {
|
|
46
46
|
const { paymentServiceType, purpose, project } = params;
|
|
47
47
|
if (purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
|
|
@@ -107,7 +107,7 @@ function publishPaymentUrl(params, options) {
|
|
|
107
107
|
await repos.orderInTransaction.savePaymentMethodId({
|
|
108
108
|
id: transaction.id,
|
|
109
109
|
paymentMethod: { paymentMethodId: result.paymentMethodId }
|
|
110
|
-
}
|
|
110
|
+
});
|
|
111
111
|
return {
|
|
112
112
|
paymentMethodId: result.paymentMethodId,
|
|
113
113
|
paymentUrl: result.paymentUrl
|
|
@@ -18,7 +18,6 @@ import type { ProductRepo } from '../repo/product';
|
|
|
18
18
|
import type { ProjectRepo } from '../repo/project';
|
|
19
19
|
import type { ReservationRepo } from '../repo/reservation';
|
|
20
20
|
import type { SellerRepo } from '../repo/seller';
|
|
21
|
-
import type { TaskRepo } from '../repo/task';
|
|
22
21
|
export declare function deleteProject(params: {
|
|
23
22
|
id: string;
|
|
24
23
|
}): (repos: {
|
|
@@ -38,7 +37,6 @@ export declare function deleteProject(params: {
|
|
|
38
37
|
movieTheater: MovieTheaterRepo;
|
|
39
38
|
screeningRoom: ScreeningRoomRepo;
|
|
40
39
|
seller: SellerRepo;
|
|
41
|
-
task: TaskRepo;
|
|
42
40
|
assetTransaction: AssetTransactionRepo;
|
|
43
41
|
}) => Promise<void>;
|
|
44
42
|
export declare function cleanUpDatabaseByProject(params: {
|
|
@@ -59,5 +57,4 @@ export declare function cleanUpDatabaseByProject(params: {
|
|
|
59
57
|
movieTheater: MovieTheaterRepo;
|
|
60
58
|
screeningRoom: ScreeningRoomRepo;
|
|
61
59
|
seller: SellerRepo;
|
|
62
|
-
task: TaskRepo;
|
|
63
60
|
}) => Promise<void>;
|
|
@@ -26,6 +26,5 @@ function cleanUpDatabaseByProject(params) {
|
|
|
26
26
|
await repos.product.deleteByProject({ project: { id: params.id } });
|
|
27
27
|
await repos.reservation.deleteByProject({ project: { id: params.id } });
|
|
28
28
|
await repos.seller.deleteByProject({ project: { id: params.id } });
|
|
29
|
-
await repos.task.deleteByProject({ project: { id: params.id } });
|
|
30
29
|
};
|
|
31
30
|
}
|
|
@@ -42,7 +42,7 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
|
42
42
|
// );
|
|
43
43
|
const taskIdentifier = `${project.id}:${factory_1.factory.taskName.OnAuthorizationCreated}:${factory_1.factory.assetTransactionType.Reserve}:${reservationNumber}:onReservationConfirmed`;
|
|
44
44
|
onAuthorizationCreatedTask = {
|
|
45
|
-
alternateName: taskIdentifier,
|
|
45
|
+
// alternateName: taskIdentifier,
|
|
46
46
|
identifier: taskIdentifier,
|
|
47
47
|
name: factory_1.factory.taskName.OnAuthorizationCreated,
|
|
48
48
|
status: factory_1.factory.taskStatus.Ready,
|
|
@@ -137,7 +137,7 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
|
137
137
|
await repos.task.saveMany(taskAttributes);
|
|
138
138
|
}
|
|
139
139
|
if (onAuthorizationCreatedTask !== undefined) {
|
|
140
|
-
await repos.task.
|
|
140
|
+
await repos.task.runTaskByIdentifier(onAuthorizationCreatedTask);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { IExecuteSettings as IMinimumExecuteSettings, IRunningTask } from '../eventEmitter/task';
|
|
2
|
-
|
|
3
|
-
interface IExecuteSettings extends IMinimumExecuteSettings {
|
|
4
|
-
aggregationSettings?: AggregationSettings;
|
|
5
|
-
}
|
|
2
|
+
type IExecuteSettings = IMinimumExecuteSettings;
|
|
6
3
|
type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
7
4
|
/**
|
|
8
5
|
* Runningの予定タスクを実行する
|
|
@@ -19,22 +19,15 @@ function executeScheduledTaskById(params) {
|
|
|
19
19
|
const { id } = params;
|
|
20
20
|
let task = null;
|
|
21
21
|
try {
|
|
22
|
-
task = await scheduledTaskRepo.findRunningScheduledTaskById({
|
|
23
|
-
id,
|
|
24
|
-
// status,
|
|
25
|
-
// executor: { name: executor.name }
|
|
26
|
-
});
|
|
22
|
+
task = await scheduledTaskRepo.findRunningScheduledTaskById({ id });
|
|
27
23
|
}
|
|
28
24
|
catch (error) {
|
|
29
25
|
/* istanbul ignore next */
|
|
30
|
-
debug('
|
|
26
|
+
debug('scheduledTaskRepo.findRunningScheduledTaskById error:', error);
|
|
31
27
|
}
|
|
32
28
|
// タスクがなければ終了
|
|
33
29
|
if (task !== null) {
|
|
34
|
-
await (0, scheduledTaskHandler_1.executeScheduledTask)(task)(settings, {
|
|
35
|
-
executeById: true,
|
|
36
|
-
executeByName: false
|
|
37
|
-
});
|
|
30
|
+
await (0, scheduledTaskHandler_1.executeScheduledTask)(task)(settings, {});
|
|
38
31
|
}
|
|
39
32
|
};
|
|
40
33
|
}
|