@chevre/domain 26.0.0-alpha.4 → 26.0.0-alpha.40
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 +7 -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/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
|
@@ -16,9 +16,6 @@ interface IReadyTask {
|
|
|
16
16
|
id: string;
|
|
17
17
|
name?: factory.taskName;
|
|
18
18
|
status: factory.taskStatus.Ready;
|
|
19
|
-
remainingNumberOfTries?: never;
|
|
20
|
-
expires?: Date;
|
|
21
|
-
executionResult?: never;
|
|
22
19
|
}
|
|
23
20
|
/**
|
|
24
21
|
* タスク名不明の遅延実行中タスク
|
|
@@ -27,9 +24,6 @@ interface IRunningTask {
|
|
|
27
24
|
id: string;
|
|
28
25
|
status: factory.taskStatus.Running;
|
|
29
26
|
name?: never;
|
|
30
|
-
remainingNumberOfTries?: never;
|
|
31
|
-
expires?: never;
|
|
32
|
-
executionResult?: never;
|
|
33
27
|
}
|
|
34
28
|
/**
|
|
35
29
|
* タスク名指定での遅延実行中タスク
|
|
@@ -38,35 +32,26 @@ interface IRunningTaskByName {
|
|
|
38
32
|
id: string;
|
|
39
33
|
status: factory.taskStatus.Running;
|
|
40
34
|
name: factory.taskName;
|
|
41
|
-
remainingNumberOfTries?: never;
|
|
42
|
-
expires?: never;
|
|
43
|
-
executionResult?: never;
|
|
44
35
|
}
|
|
45
36
|
/**
|
|
46
|
-
*
|
|
37
|
+
* タスクステータス変更イベント発火時パラメータとしてのタスク
|
|
47
38
|
*/
|
|
48
|
-
|
|
39
|
+
type IChangedTask = IReadyTask | IRunningTask | IRunningTaskByName;
|
|
40
|
+
type IOperationExecute<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
41
|
+
interface ITaskAsNextFunctionParam {
|
|
49
42
|
id: string;
|
|
50
43
|
status: factory.taskStatus.Executed | factory.taskStatus.Running | factory.taskStatus.Aborted;
|
|
51
44
|
name: factory.taskName;
|
|
52
|
-
executionResult: factory.task.IExecutionResult;
|
|
53
|
-
/**
|
|
54
|
-
* 実行されたタスクの残り試行回数
|
|
55
|
-
*/
|
|
56
|
-
remainingNumberOfTries: number;
|
|
57
|
-
expires?: never;
|
|
58
45
|
}
|
|
59
|
-
type
|
|
60
|
-
type
|
|
61
|
-
type INextFunction = (task: IExecutedTask) => IOperationExecute<void>;
|
|
62
|
-
type IOnTaskStatusChangedListener = (task: IChangedTask, next?: INextFunction) => void;
|
|
46
|
+
type IAsyncActionNextFunction = (task: ITaskAsNextFunctionParam) => IOperationExecute<void>;
|
|
47
|
+
type IOnTaskStatusChangedListener = (task: IChangedTask) => void;
|
|
63
48
|
type RedisClientType = ReturnType<typeof createClient>;
|
|
64
49
|
/**
|
|
65
50
|
* タスクイベントエミッター
|
|
66
51
|
*/
|
|
67
52
|
declare class TaskEventEmitter extends EventEmitter {
|
|
68
53
|
onTaskStatusChanged(listener: IOnTaskStatusChangedListener): void;
|
|
69
|
-
emitTaskStatusChanged(task: IChangedTask
|
|
54
|
+
emitTaskStatusChanged(task: IChangedTask): void;
|
|
70
55
|
}
|
|
71
56
|
declare const taskEventEmitter: TaskEventEmitter;
|
|
72
|
-
export { IChangedTask, IReadyTask, IRunningTask, IRunningTaskByName,
|
|
57
|
+
export { IChangedTask, IReadyTask, IRunningTask, IRunningTaskByName, IExecuteSettings, IOnTaskStatusChangedListener, taskEventEmitter, ITaskAsNextFunctionParam, IAsyncActionNextFunction };
|
|
@@ -14,8 +14,8 @@ class TaskEventEmitter extends events_1.EventEmitter {
|
|
|
14
14
|
this.on(EventName.OnTaskStatusChanged, listener);
|
|
15
15
|
}
|
|
16
16
|
// support next function required(2025-05-25~)
|
|
17
|
-
emitTaskStatusChanged(task
|
|
18
|
-
this.emit(EventName.OnTaskStatusChanged, task
|
|
17
|
+
emitTaskStatusChanged(task) {
|
|
18
|
+
this.emit(EventName.OnTaskStatusChanged, task);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
const taskEventEmitter = new TaskEventEmitter();
|
|
@@ -27,13 +27,6 @@ export declare class AcceptedOfferRepo extends AcceptedOfferInReserveRepo {
|
|
|
27
27
|
acceptedOffers: [IAcceptedOffer];
|
|
28
28
|
_id?: never;
|
|
29
29
|
})[]>;
|
|
30
|
-
aggreateOwnershipInfosByOrder(filter: {
|
|
31
|
-
orderNumber: {
|
|
32
|
-
$eq: string;
|
|
33
|
-
};
|
|
34
|
-
}): Promise<{
|
|
35
|
-
identifier: string;
|
|
36
|
-
}[]>;
|
|
37
30
|
/**
|
|
38
31
|
* 注文オファーを展開して検索する
|
|
39
32
|
* 注文番号指定で1注文ドキュメントから参照する想定
|
|
@@ -105,33 +105,33 @@ class AcceptedOfferRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveR
|
|
|
105
105
|
return orders;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
async aggreateOwnershipInfosByOrder(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
108
|
+
// public async aggreateOwnershipInfosByOrder(
|
|
109
|
+
// filter: {
|
|
110
|
+
// orderNumber: { $eq: string };
|
|
111
|
+
// }
|
|
112
|
+
// ): Promise<{ identifier: string }[]> {
|
|
113
|
+
// const aggregate = this.orderModel.aggregate<{ identifier: string }>([
|
|
114
|
+
// { $match: { orderNumber: { $eq: filter.orderNumber.$eq } } },
|
|
115
|
+
// { $match: { typeOf: { $eq: factory.order.OrderType.Order } } },
|
|
116
|
+
// {
|
|
117
|
+
// $unwind: {
|
|
118
|
+
// path: '$acceptedOffers',
|
|
119
|
+
// includeArrayIndex: 'acceptedOfferIndex'
|
|
120
|
+
// }
|
|
121
|
+
// },
|
|
122
|
+
// {
|
|
123
|
+
// $project: {
|
|
124
|
+
// _id: 0,
|
|
125
|
+
// identifier: {
|
|
126
|
+
// $concat: ['$customer.id', '-', '$acceptedOffers.itemOffered.typeOf', '-', '$orderNumber', '-', { $toString: '$acceptedOfferIndex' }]
|
|
127
|
+
// }
|
|
128
|
+
// }
|
|
129
|
+
// }
|
|
130
|
+
// ]);
|
|
131
|
+
// return aggregate
|
|
132
|
+
// .option({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
133
|
+
// .exec();
|
|
134
|
+
// }
|
|
135
135
|
/**
|
|
136
136
|
* 注文オファーを展開して検索する
|
|
137
137
|
* 注文番号指定で1注文ドキュメントから参照する想定
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { IActionRecipe, IKeyOfProjection, ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { IActionRecipe, IKeyOfProjection, ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAcceptCOAOfferAction = factory.action.accept.coaOffer.IAction;
|
|
4
5
|
/**
|
|
5
6
|
* COAオファー採用リポジトリ
|
|
6
7
|
*/
|
|
7
8
|
export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptCOAOfferAction, IActionRecipe<factory.recipe.RecipeCategory.acceptCOAOffer>> {
|
|
9
|
+
constructor(connection: Connection);
|
|
8
10
|
/**
|
|
9
11
|
* 完了済の採用アクションを参照する
|
|
10
12
|
*/
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AcceptCOAOfferActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
|
|
6
|
-
const
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
6
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
7
7
|
/**
|
|
8
8
|
* COAオファー採用リポジトリ
|
|
9
9
|
*/
|
|
10
10
|
class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
super({ connection }, {
|
|
13
|
+
expireAfterSeconds: EXPIRE_AFTER_SECONDS,
|
|
14
|
+
recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
|
|
15
|
+
});
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* 完了済の採用アクションを参照する
|
|
13
19
|
*/
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAcceptPayAction = factory.action.accept.pay.IAction;
|
|
4
5
|
/**
|
|
5
6
|
* 決済採用リポジトリ
|
|
6
7
|
*/
|
|
7
8
|
export declare class AcceptPayActionRepo extends ActionProcessRepo<IAcceptPayAction, IActionRecipe<factory.recipe.RecipeCategory.publishPaymentUrl>> {
|
|
9
|
+
constructor(connection: Connection);
|
|
8
10
|
/**
|
|
9
11
|
* 注文取引から検索する
|
|
10
12
|
* 件数はlimitされない
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AcceptPayActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
|
|
6
|
-
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
7
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
8
|
-
const actionProcess_1 = require("./actionProcess");
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
9
6
|
/**
|
|
10
7
|
* 決済採用リポジトリ
|
|
11
8
|
*/
|
|
12
9
|
class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
10
|
+
constructor(connection) {
|
|
11
|
+
super({ connection }, {
|
|
12
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
13
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
13
16
|
/**
|
|
14
17
|
* 注文取引から検索する
|
|
15
18
|
* 件数はlimitされない
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
|
-
import { factory } from '
|
|
3
|
-
import { IModel as IActionModel } from '
|
|
4
|
-
import {
|
|
2
|
+
import { factory } from '../../../factory';
|
|
3
|
+
import { IModel as IActionModel, IDocType } from '../../mongoose/schemas/action';
|
|
4
|
+
import { ActionRecipeRepo, IActionRecipe, IRecipeAsActionAttributes } from './actionRecipe';
|
|
5
5
|
export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
purpose?: never;
|
|
9
|
-
} : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
6
|
+
type IAuthorizeAction = factory.action.authorize.invoice.IAction | factory.action.authorize.offer.eventService.IAction | factory.action.authorize.paymentMethod.any.IAction | factory.action.authorize.ticketedObject.IAction;
|
|
7
|
+
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? IAuthorizeAction : T extends factory.actionType.CheckAction ? factory.action.check.paymentMethod.movieTicket.IAction : T extends factory.actionType.CreateAction ? factory.action.create.IAction : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
10
8
|
export interface ICancelActionAction {
|
|
11
9
|
typeOf: factory.actionType.CancelAction;
|
|
12
10
|
agent: factory.action.IParticipantAsPerson | factory.action.IParticipantAsProject | factory.action.IParticipantAsWebApplication;
|
|
@@ -17,28 +15,24 @@ export interface ICancelActionAction {
|
|
|
17
15
|
typeOf: 'Task';
|
|
18
16
|
};
|
|
19
17
|
}
|
|
20
|
-
export
|
|
21
|
-
export type
|
|
22
|
-
recipeFor: {
|
|
23
|
-
id: string;
|
|
24
|
-
typeOf: factory.actionType;
|
|
25
|
-
};
|
|
26
|
-
dateCreated: Date;
|
|
27
|
-
dateModified?: Date;
|
|
28
|
-
};
|
|
29
|
-
export type IRecipeAsActionAttributes<T extends factory.recipe.RecipeCategory> = Pick<IActionRecipe<T>, 'project' | 'recipeCategory' | 'step' | 'typeOf'>;
|
|
30
|
-
export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
|
|
31
|
-
knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
|
|
32
|
-
};
|
|
33
|
-
export type IKeyOfProjection = keyof IAction<factory.actionType> | keyof IAction<factory.actionType.AuthorizeAction> | keyof IAction<factory.actionType.ReplaceAction> | 'identifier';
|
|
18
|
+
export { IActionRecipe };
|
|
19
|
+
export type IKeyOfProjection = keyof IDocType | 'id';
|
|
34
20
|
export declare const AVAILABLE_PROJECT_FIELDS: IKeyOfProjection[];
|
|
21
|
+
interface IOptions {
|
|
22
|
+
expireAfterSeconds: number;
|
|
23
|
+
recipeExpireAfterSeconds: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_EXPIRE_AFTER_SECONDS = 17280000;
|
|
26
|
+
export declare const RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = 17280000;
|
|
35
27
|
/**
|
|
36
28
|
* アクション状態管理リポジトリ
|
|
37
29
|
*/
|
|
38
|
-
export declare class ActionProcessRepo<TAction extends IAction<factory.actionType>, TActionRecipe extends IActionRecipe<factory.recipe.RecipeCategory>> {
|
|
30
|
+
export declare class ActionProcessRepo<TAction extends IAction<factory.actionType>, TActionRecipe extends IActionRecipe<factory.recipe.RecipeCategory>> extends ActionRecipeRepo<TActionRecipe> {
|
|
39
31
|
protected readonly actionModel: IActionModel;
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
32
|
+
private options;
|
|
33
|
+
protected constructor(params: {
|
|
34
|
+
connection: Connection;
|
|
35
|
+
}, options: IOptions);
|
|
42
36
|
static CREATE_MONGO_CONDITIONS(params: factory.action.ISearchConditions): any[];
|
|
43
37
|
/**
|
|
44
38
|
* アクション開始
|
|
@@ -70,26 +64,6 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
|
|
|
70
64
|
error: Error | Error[] | unknown;
|
|
71
65
|
recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
|
|
72
66
|
}): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
|
|
75
|
-
*/
|
|
76
|
-
giveUpStartDatePassedCertainPeriod(params: {
|
|
77
|
-
id?: {
|
|
78
|
-
$eq?: string;
|
|
79
|
-
};
|
|
80
|
-
error: any;
|
|
81
|
-
startDate: {
|
|
82
|
-
$lt: Date;
|
|
83
|
-
};
|
|
84
|
-
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
85
|
-
findRecipeByAction<T extends TActionRecipe['recipeCategory']>(params: {
|
|
86
|
-
project: {
|
|
87
|
-
id: string;
|
|
88
|
-
};
|
|
89
|
-
recipeFor: {
|
|
90
|
-
id: string;
|
|
91
|
-
};
|
|
92
|
-
}): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null>;
|
|
93
67
|
findById(params: {
|
|
94
68
|
typeOf: TAction['typeOf'];
|
|
95
69
|
id: string;
|
|
@@ -143,5 +117,4 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
|
|
|
143
117
|
};
|
|
144
118
|
sort?: factory.action.ISortOrder;
|
|
145
119
|
}): Promise<TAction[]>;
|
|
146
|
-
protected upsertRecipe(savingRecipe: Pick<IRecipeAsDocument, 'project' | 'recipeCategory' | 'recipeFor' | 'step' | 'typeOf'>): Promise<void>;
|
|
147
120
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActionProcessRepo = exports.AVAILABLE_PROJECT_FIELDS = void 0;
|
|
4
|
-
const factory_1 = require("
|
|
5
|
-
const settings_1 = require("
|
|
6
|
-
const action_1 = require("
|
|
7
|
-
const
|
|
3
|
+
exports.ActionProcessRepo = exports.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = exports.DEFAULT_EXPIRE_AFTER_SECONDS = exports.AVAILABLE_PROJECT_FIELDS = void 0;
|
|
4
|
+
const factory_1 = require("../../../factory");
|
|
5
|
+
const settings_1 = require("../../../settings");
|
|
6
|
+
const action_1 = require("../../mongoose/schemas/action");
|
|
7
|
+
const unknown2actionError_1 = require("../unknown2actionError");
|
|
8
|
+
const actionRecipe_1 = require("./actionRecipe");
|
|
8
9
|
exports.AVAILABLE_PROJECT_FIELDS = [
|
|
9
10
|
'project',
|
|
10
11
|
'actionStatus',
|
|
@@ -19,40 +20,26 @@ exports.AVAILABLE_PROJECT_FIELDS = [
|
|
|
19
20
|
'endDate',
|
|
20
21
|
'purpose',
|
|
21
22
|
'potentialActions',
|
|
22
|
-
// 'amount', // discontinue(2026-07-08~)
|
|
23
|
-
// 'fromLocation', // discontinue(2026-07-08~)
|
|
24
|
-
// 'toLocation', // discontinue(2026-07-08~)
|
|
25
23
|
'instrument',
|
|
26
24
|
'location',
|
|
27
|
-
'replacer',
|
|
28
|
-
'targetCollection',
|
|
29
25
|
'sameAs',
|
|
30
26
|
'cancelAction',
|
|
31
27
|
'about',
|
|
32
|
-
'
|
|
33
|
-
'
|
|
28
|
+
'identifier',
|
|
29
|
+
'expires'
|
|
34
30
|
];
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
if (e instanceof Error) {
|
|
38
|
-
// Errorオブジェクトの場合は、既存のロジック通り展開
|
|
39
|
-
return { ...e, name: e.name, message: e.message };
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// Error以外(文字列など)が投げられた場合のハンドリング
|
|
43
|
-
return { name: 'UnknownError', message: String(e) };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
;
|
|
31
|
+
exports.DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; // 200 days
|
|
32
|
+
exports.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; // 200 days
|
|
47
33
|
/**
|
|
48
34
|
* アクション状態管理リポジトリ
|
|
49
35
|
*/
|
|
50
|
-
class ActionProcessRepo {
|
|
36
|
+
class ActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
|
|
51
37
|
actionModel;
|
|
52
|
-
|
|
53
|
-
constructor(
|
|
54
|
-
|
|
55
|
-
this.
|
|
38
|
+
options;
|
|
39
|
+
constructor(params, options) {
|
|
40
|
+
super(params, options);
|
|
41
|
+
this.actionModel = params.connection.model(action_1.modelName, (0, action_1.createSchema)());
|
|
42
|
+
this.options = options;
|
|
56
43
|
}
|
|
57
44
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
58
45
|
const andConditions = []; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -453,15 +440,15 @@ class ActionProcessRepo {
|
|
|
453
440
|
/**
|
|
454
441
|
* アクション開始
|
|
455
442
|
*/
|
|
456
|
-
async start(
|
|
457
|
-
// public async start<T extends Exclude<TAction['typeOf'], factory.actionType.AcceptAction>>(
|
|
458
|
-
attributes, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
443
|
+
async start(attributes, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
459
444
|
options) {
|
|
460
445
|
const startDate = new Date();
|
|
446
|
+
const expires = new Date(startDate.getTime() + this.options.expireAfterSeconds * 1000);
|
|
461
447
|
const creatingAction = {
|
|
462
448
|
...attributes,
|
|
463
449
|
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
464
|
-
startDate
|
|
450
|
+
startDate,
|
|
451
|
+
expires
|
|
465
452
|
};
|
|
466
453
|
// reimplemnt with insertMany(2024-08-29~)
|
|
467
454
|
const result = await this.actionModel.insertMany(creatingAction, { rawResult: true });
|
|
@@ -477,6 +464,7 @@ class ActionProcessRepo {
|
|
|
477
464
|
return { id, startDate, typeOf: creatingAction.typeOf };
|
|
478
465
|
}
|
|
479
466
|
async completeWithVoid(params) {
|
|
467
|
+
const endDate = new Date();
|
|
480
468
|
if (params.recipe?.typeOf === 'Recipe') {
|
|
481
469
|
await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
482
470
|
}
|
|
@@ -487,7 +475,7 @@ class ActionProcessRepo {
|
|
|
487
475
|
$set: {
|
|
488
476
|
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
489
477
|
result: params.result,
|
|
490
|
-
endDate
|
|
478
|
+
endDate
|
|
491
479
|
}
|
|
492
480
|
}, { new: false, projection: { _id: 1 } })
|
|
493
481
|
.lean()
|
|
@@ -538,12 +526,10 @@ class ActionProcessRepo {
|
|
|
538
526
|
* アクション失敗
|
|
539
527
|
*/
|
|
540
528
|
async giveUp(params) {
|
|
541
|
-
|
|
542
|
-
// ? params.error.map((e) => ({ ...e, message: e.message, name: e.name }))
|
|
543
|
-
// : { ...params.error, message: params.error.message, name: params.error.name };
|
|
529
|
+
const endDate = new Date();
|
|
544
530
|
const actionError = Array.isArray(params.error)
|
|
545
|
-
? params.error.map(unknown2actionError)
|
|
546
|
-
: unknown2actionError(params.error);
|
|
531
|
+
? params.error.map(unknown2actionError_1.unknown2actionError)
|
|
532
|
+
: (0, unknown2actionError_1.unknown2actionError)(params.error);
|
|
547
533
|
if (params.recipe?.typeOf === 'Recipe') {
|
|
548
534
|
await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
549
535
|
}
|
|
@@ -554,7 +540,7 @@ class ActionProcessRepo {
|
|
|
554
540
|
$set: {
|
|
555
541
|
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
556
542
|
error: actionError,
|
|
557
|
-
endDate
|
|
543
|
+
endDate
|
|
558
544
|
}
|
|
559
545
|
}, { new: true, projection: { _id: 1 } })
|
|
560
546
|
.lean()
|
|
@@ -563,36 +549,6 @@ class ActionProcessRepo {
|
|
|
563
549
|
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
564
550
|
}
|
|
565
551
|
}
|
|
566
|
-
/**
|
|
567
|
-
* 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
|
|
568
|
-
*/
|
|
569
|
-
async giveUpStartDatePassedCertainPeriod(params) {
|
|
570
|
-
return this.actionModel.updateMany({
|
|
571
|
-
actionStatus: { $eq: factory_1.factory.actionStatusType.ActiveActionStatus },
|
|
572
|
-
// 一定期間過ぎたもの
|
|
573
|
-
startDate: { $lt: params.startDate.$lt },
|
|
574
|
-
...(typeof params.id?.$eq === 'string') ? { _id: { $eq: params.id.$eq } } : undefined
|
|
575
|
-
}, {
|
|
576
|
-
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
577
|
-
error: params.error,
|
|
578
|
-
endDate: new Date()
|
|
579
|
-
})
|
|
580
|
-
.exec();
|
|
581
|
-
}
|
|
582
|
-
async findRecipeByAction(params) {
|
|
583
|
-
return this.actionRecipeModel.findOne({
|
|
584
|
-
'project.id': { $eq: params.project.id },
|
|
585
|
-
'recipeFor.id': { $eq: params.recipeFor.id }
|
|
586
|
-
}, { step: 1, recipeCategory: 1 }
|
|
587
|
-
// { lean: true }
|
|
588
|
-
)
|
|
589
|
-
.lean()
|
|
590
|
-
.exec();
|
|
591
|
-
// if (result === null) {
|
|
592
|
-
// throw new factory.errors.NotFound(this.actionRecipeModel.modelName);
|
|
593
|
-
// }
|
|
594
|
-
// return result;
|
|
595
|
-
}
|
|
596
552
|
async findById(params, inclusion, exclusion) {
|
|
597
553
|
let positiveProjectionFields = exports.AVAILABLE_PROJECT_FIELDS;
|
|
598
554
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
@@ -750,26 +706,5 @@ class ActionProcessRepo {
|
|
|
750
706
|
.lean()
|
|
751
707
|
.exec();
|
|
752
708
|
}
|
|
753
|
-
async upsertRecipe(savingRecipe) {
|
|
754
|
-
const dateModified = new Date();
|
|
755
|
-
const { typeOf, project, recipeCategory, recipeFor, step } = savingRecipe;
|
|
756
|
-
const filter = {
|
|
757
|
-
'recipeFor.id': { $eq: recipeFor.id }
|
|
758
|
-
};
|
|
759
|
-
const setOnInsert = {
|
|
760
|
-
project, typeOf, recipeCategory, recipeFor,
|
|
761
|
-
dateCreated: dateModified
|
|
762
|
-
};
|
|
763
|
-
const setKeys = { step, dateModified };
|
|
764
|
-
const update = {
|
|
765
|
-
$setOnInsert: setOnInsert,
|
|
766
|
-
$set: setKeys
|
|
767
|
-
};
|
|
768
|
-
await this.actionRecipeModel.updateOne(filter, update, {
|
|
769
|
-
upsert: true
|
|
770
|
-
// includeResultMetadata: true
|
|
771
|
-
})
|
|
772
|
-
.exec();
|
|
773
|
-
}
|
|
774
709
|
}
|
|
775
710
|
exports.ActionProcessRepo = ActionProcessRepo;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../../../factory';
|
|
3
|
+
import { IModel as IActionRecipeModel } from '../../mongoose/schemas/actionRecipe';
|
|
4
|
+
export type IActionRecipe<T extends factory.recipe.RecipeCategory> = T extends factory.recipe.RecipeCategory.checkMovieTicket ? factory.action.check.paymentMethod.movieTicket.IRecipe : T extends factory.recipe.RecipeCategory.payCreditCard ? factory.action.trade.pay.IPayCreditCardRecipe : T extends factory.recipe.RecipeCategory.payMovieTicket ? factory.action.trade.pay.IPayMovieTicketRecipe : T extends factory.recipe.RecipeCategory.publishPaymentUrl ? factory.action.accept.pay.IRecipe : T extends factory.recipe.RecipeCategory.refundCreditCard ? factory.action.trade.refund.IRefundCreditCardRecipe : T extends factory.recipe.RecipeCategory.refundMovieTicket ? factory.action.trade.refund.IRefundMovieTicketRecipe : T extends factory.recipe.RecipeCategory.authorizeInvoice ? factory.action.authorize.invoice.IAuthorizeInvoiceRecipe : T extends factory.recipe.RecipeCategory.authorizeInvoice3ds ? factory.action.authorize.invoice.IAuthorizeInvoice3dsRecipe : T extends factory.recipe.RecipeCategory.acceptCOAOffer ? factory.action.accept.coaOffer.IRecipe : T extends factory.recipe.RecipeCategory.confirmCOAReserve ? factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe : T extends factory.recipe.RecipeCategory.cancelPendingCOAReserve ? factory.action.cancel.coaReserve.ICancelPendingCOAReserveRecipe : T extends factory.recipe.RecipeCategory.returnCOAReserve ? factory.action.transfer.returnAction.reserveTransaction.IReturnCOAReserveRecipe : T extends factory.recipe.RecipeCategory.sendEmailMessage ? factory.action.transfer.send.message.email.IRecipe : never;
|
|
5
|
+
export type IRecipeAsDocument = factory.recipe.IRecipe & {
|
|
6
|
+
recipeFor: {
|
|
7
|
+
id: string;
|
|
8
|
+
typeOf: factory.actionType;
|
|
9
|
+
};
|
|
10
|
+
dateCreated: Date;
|
|
11
|
+
dateModified?: Date;
|
|
12
|
+
expires: Date;
|
|
13
|
+
};
|
|
14
|
+
export type IRecipeAsActionAttributes<T extends factory.recipe.RecipeCategory> = Pick<IActionRecipe<T>, 'project' | 'recipeCategory' | 'step' | 'typeOf'>;
|
|
15
|
+
interface IOptions {
|
|
16
|
+
recipeExpireAfterSeconds: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* アクションレシピリポジトリ
|
|
20
|
+
*/
|
|
21
|
+
export declare class ActionRecipeRepo<TActionRecipe extends IActionRecipe<factory.recipe.RecipeCategory>> {
|
|
22
|
+
protected readonly actionRecipeModel: IActionRecipeModel;
|
|
23
|
+
private recipeOptions;
|
|
24
|
+
protected constructor(params: {
|
|
25
|
+
connection: Connection;
|
|
26
|
+
}, options: IOptions);
|
|
27
|
+
findRecipeByAction<T extends TActionRecipe['recipeCategory']>(params: {
|
|
28
|
+
project: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
recipeFor: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null>;
|
|
35
|
+
upsertRecipe(savingRecipe: Pick<IRecipeAsDocument, 'project' | 'recipeCategory' | 'recipeFor' | 'step' | 'typeOf'>): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionRecipeRepo = void 0;
|
|
4
|
+
const actionRecipe_1 = require("../../mongoose/schemas/actionRecipe");
|
|
5
|
+
/**
|
|
6
|
+
* アクションレシピリポジトリ
|
|
7
|
+
*/
|
|
8
|
+
class ActionRecipeRepo {
|
|
9
|
+
actionRecipeModel;
|
|
10
|
+
recipeOptions;
|
|
11
|
+
constructor(params, options) {
|
|
12
|
+
this.actionRecipeModel = params.connection.model(actionRecipe_1.modelName, (0, actionRecipe_1.createSchema)());
|
|
13
|
+
this.recipeOptions = options;
|
|
14
|
+
}
|
|
15
|
+
async findRecipeByAction(params) {
|
|
16
|
+
return this.actionRecipeModel.findOne({
|
|
17
|
+
'project.id': { $eq: params.project.id },
|
|
18
|
+
'recipeFor.id': { $eq: params.recipeFor.id }
|
|
19
|
+
}, { step: 1, recipeCategory: 1 }
|
|
20
|
+
// { lean: true }
|
|
21
|
+
)
|
|
22
|
+
.lean()
|
|
23
|
+
.exec();
|
|
24
|
+
// if (result === null) {
|
|
25
|
+
// throw new factory.errors.NotFound(this.actionRecipeModel.modelName);
|
|
26
|
+
// }
|
|
27
|
+
// return result;
|
|
28
|
+
}
|
|
29
|
+
async upsertRecipe(savingRecipe) {
|
|
30
|
+
const dateModified = new Date();
|
|
31
|
+
const expires = new Date(dateModified.getTime() + this.recipeOptions.recipeExpireAfterSeconds * 1000);
|
|
32
|
+
const { typeOf, project, recipeCategory, recipeFor, step } = savingRecipe;
|
|
33
|
+
const filter = {
|
|
34
|
+
'recipeFor.id': { $eq: recipeFor.id }
|
|
35
|
+
};
|
|
36
|
+
const setOnInsert = {
|
|
37
|
+
project, typeOf, recipeCategory, recipeFor,
|
|
38
|
+
dateCreated: dateModified,
|
|
39
|
+
expires // 必須化(2026-08-16~)
|
|
40
|
+
};
|
|
41
|
+
const setKeys = { step, dateModified };
|
|
42
|
+
const update = {
|
|
43
|
+
$setOnInsert: setOnInsert,
|
|
44
|
+
$set: setKeys
|
|
45
|
+
};
|
|
46
|
+
await this.actionRecipeModel.updateOne(filter, update, {
|
|
47
|
+
upsert: true
|
|
48
|
+
// includeResultMetadata: true
|
|
49
|
+
})
|
|
50
|
+
.exec();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ActionRecipeRepo = ActionRecipeRepo;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './actionProcess';
|
|
3
|
-
export type IAuthorizeInvoiceAction = factory.action.authorize.invoice.IAction
|
|
4
|
-
/**
|
|
5
|
-
* 実際存在しない属性だが、ActionProcessRepoのTActionに適合させるために補完
|
|
6
|
-
*/
|
|
7
|
-
recipient: any;
|
|
8
|
-
};
|
|
3
|
+
import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './anyAction/actionProcess';
|
|
4
|
+
export type IAuthorizeInvoiceAction = factory.action.authorize.invoice.IAction;
|
|
9
5
|
/**
|
|
10
6
|
* インボイス承認リポジトリ
|
|
11
7
|
*/
|
|
12
8
|
export declare class AuthorizeInvoiceActionRepo extends ActionProcessRepo<IAuthorizeInvoiceAction, IActionRecipe<factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds>> {
|
|
9
|
+
constructor(connection: Connection);
|
|
13
10
|
/**
|
|
14
11
|
* 決済取引からインボイス承認アクションをひとつ参照する
|
|
15
12
|
*/
|
|
@@ -22,5 +19,5 @@ export declare class AuthorizeInvoiceActionRepo extends ActionProcessRepo<IAutho
|
|
|
22
19
|
* 決済取引ID
|
|
23
20
|
*/
|
|
24
21
|
payTransactionId: string;
|
|
25
|
-
}, inclusion: IKeyOfProjection[]): Promise<
|
|
22
|
+
}, inclusion: IKeyOfProjection[]): Promise<import("@chevre/factory/lib/chevre/action/authorize/invoice").IAction[]>;
|
|
26
23
|
}
|