@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
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizeInvoiceActionRepo = 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 AuthorizeInvoiceActionRepo 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
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAuthorizeEventServiceOfferAction = factory.action.authorize.offer.eventService.IAction;
|
|
4
5
|
export type IAuthorizeOfferAction = IAuthorizeEventServiceOfferAction;
|
|
5
6
|
export type IAuthorizeOfferActionWithInstrument = Pick<IAuthorizeEventServiceOfferAction, 'instrument'>;
|
|
@@ -7,6 +8,7 @@ export type IAuthorizeOfferActionWithInstrument = Pick<IAuthorizeEventServiceOff
|
|
|
7
8
|
* オファー承認リポジトリ
|
|
8
9
|
*/
|
|
9
10
|
export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthorizeOfferAction, never> {
|
|
11
|
+
constructor(connection: Connection);
|
|
10
12
|
findAuthorizeOfferInstrumentsByIds(params: {
|
|
11
13
|
/**
|
|
12
14
|
* 注文取引
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizeOfferActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
|
|
6
|
-
const actionProcess_1 = require("./actionProcess");
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
7
6
|
/**
|
|
8
7
|
* オファー承認リポジトリ
|
|
9
8
|
*/
|
|
10
9
|
class AuthorizeOfferActionRepo 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
|
+
}
|
|
11
16
|
async findAuthorizeOfferInstrumentsByIds(params) {
|
|
12
17
|
if (!Array.isArray(params.ids)) {
|
|
13
18
|
throw new factory_1.factory.errors.Argument('ids', 'must be Array');
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAuthorizePaymentMethodAction = factory.action.authorize.paymentMethod.any.IAction;
|
|
4
5
|
export type IActionRecipe = never;
|
|
5
6
|
/**
|
|
6
7
|
* 決済承認リポジトリ
|
|
7
8
|
*/
|
|
8
9
|
export declare class AuthorizePaymentMethodActionRepo extends ActionProcessRepo<IAuthorizePaymentMethodAction, IActionRecipe> {
|
|
10
|
+
constructor(connection: Connection);
|
|
9
11
|
/**
|
|
10
12
|
* 取引に対する決済承認アクションを検索する
|
|
11
13
|
*/
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizePaymentMethodActionRepo = 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 AuthorizePaymentMethodActionRepo 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
|
*/
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAuthorizeTicketedObjectAction = factory.action.authorize.ticketedObject.IAction;
|
|
4
5
|
/**
|
|
5
6
|
* 決済とオファー以外に対する汎用承認リポジトリ
|
|
6
7
|
*/
|
|
7
8
|
export declare class AuthorizeTicketedObjectActionRepo extends ActionProcessRepo<IAuthorizeTicketedObjectAction, never> {
|
|
9
|
+
constructor(connection: Connection);
|
|
8
10
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizeTicketedObjectActionRepo = void 0;
|
|
4
|
-
|
|
5
|
-
const actionProcess_1 = require("./actionProcess");
|
|
4
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
6
5
|
/**
|
|
7
6
|
* 決済とオファー以外に対する汎用承認リポジトリ
|
|
8
7
|
*/
|
|
9
8
|
class AuthorizeTicketedObjectActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
9
|
+
constructor(connection) {
|
|
10
|
+
super({ connection }, {
|
|
11
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
12
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
13
|
+
});
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
exports.AuthorizeTicketedObjectActionRepo = AuthorizeTicketedObjectActionRepo;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Surfrock } from '@surfrock/sdk';
|
|
2
|
+
import type { Connection } from 'mongoose';
|
|
2
3
|
import { factory } from '../../factory';
|
|
3
|
-
import { ActionProcessRepo, IActionRecipe } from './actionProcess';
|
|
4
|
+
import { ActionProcessRepo, IActionRecipe } from './anyAction/actionProcess';
|
|
4
5
|
export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
|
|
5
6
|
knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
|
|
6
7
|
};
|
|
@@ -60,6 +61,7 @@ export type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTi
|
|
|
60
61
|
* 決済カード認証アクションリポジトリ
|
|
61
62
|
*/
|
|
62
63
|
export declare class CheckMovieTicketActionRepo extends ActionProcessRepo<ICheckMovieTicketAction, IActionRecipe<factory.recipe.RecipeCategory.checkMovieTicket>> {
|
|
64
|
+
constructor(connection: Connection);
|
|
63
65
|
/**
|
|
64
66
|
* アクションIDからレシピのafterMediaを参照する
|
|
65
67
|
*/
|
|
@@ -3,11 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CheckMovieTicketActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
5
|
const settings_1 = require("../../settings");
|
|
6
|
-
const actionProcess_1 = require("./actionProcess");
|
|
6
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
7
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
7
8
|
/**
|
|
8
9
|
* 決済カード認証アクションリポジトリ
|
|
9
10
|
*/
|
|
10
11
|
class CheckMovieTicketActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
12
|
+
constructor(connection) {
|
|
13
|
+
super({ connection }, {
|
|
14
|
+
expireAfterSeconds: EXPIRE_AFTER_SECONDS,
|
|
15
|
+
recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
|
|
16
|
+
});
|
|
17
|
+
}
|
|
11
18
|
/**
|
|
12
19
|
* アクションIDからレシピのafterMediaを参照する
|
|
13
20
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../../factory';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
4
|
+
export type ICreateAction = factory.action.create.IAction;
|
|
5
|
+
/**
|
|
6
|
+
* レポート作成アクションリポジトリ
|
|
7
|
+
*/
|
|
8
|
+
export declare class CreateActionRepo extends ActionProcessRepo<ICreateAction, never> {
|
|
9
|
+
constructor(connection: Connection);
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateActionRepo = void 0;
|
|
4
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
5
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
6
|
+
/**
|
|
7
|
+
* レポート作成アクションリポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class CreateActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
10
|
+
constructor(connection) {
|
|
11
|
+
super({ connection }, {
|
|
12
|
+
expireAfterSeconds: EXPIRE_AFTER_SECONDS,
|
|
13
|
+
recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CreateActionRepo = CreateActionRepo;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { factory } from '../../factory';
|
|
3
|
+
import { IDocType } from '../mongoose/schemas/action/inform';
|
|
4
|
+
type StartableActionType = factory.actionType.InformAction;
|
|
5
|
+
type IAction = IDocType & {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
type IKeyOfProjection = keyof IDocType;
|
|
9
|
+
type IFindParams = Pick<factory.action.ISearchConditions, 'limit' | 'page' | 'project' | 'sort' | 'startFrom' | 'startThrough'> & {
|
|
10
|
+
id?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 通知アクションリポジトリ
|
|
14
|
+
*/
|
|
15
|
+
export declare class InformActionRepo {
|
|
16
|
+
private readonly informActionModel;
|
|
17
|
+
constructor(connection: Connection);
|
|
18
|
+
static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<IDocType>[];
|
|
19
|
+
/**
|
|
20
|
+
* アクション開始
|
|
21
|
+
*/
|
|
22
|
+
startInformAction(attributes: factory.action.interact.inform.IAttributes): Promise<Pick<IAction, 'id' | 'typeOf' | 'startDate'>>;
|
|
23
|
+
completeInformAction(params: {
|
|
24
|
+
typeOf: StartableActionType;
|
|
25
|
+
id: string;
|
|
26
|
+
result: factory.action.interact.inform.IResult;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* アクション失敗
|
|
30
|
+
*/
|
|
31
|
+
giveUpInformAction(params: {
|
|
32
|
+
typeOf: StartableActionType;
|
|
33
|
+
id: string;
|
|
34
|
+
error: Error | Error[] | unknown;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
findInformActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction[]>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InformActionRepo = void 0;
|
|
4
|
+
const factory_1 = require("../../factory");
|
|
5
|
+
const settings_1 = require("../../settings");
|
|
6
|
+
const inform_1 = require("../mongoose/schemas/action/inform");
|
|
7
|
+
const unknown2actionError_1 = require("./unknown2actionError");
|
|
8
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
9
|
+
'project',
|
|
10
|
+
'actionStatus',
|
|
11
|
+
'typeOf',
|
|
12
|
+
'agent',
|
|
13
|
+
'result',
|
|
14
|
+
'error',
|
|
15
|
+
'object',
|
|
16
|
+
'startDate',
|
|
17
|
+
'endDate',
|
|
18
|
+
'about',
|
|
19
|
+
'purpose',
|
|
20
|
+
'recipient',
|
|
21
|
+
'target',
|
|
22
|
+
'expires'
|
|
23
|
+
];
|
|
24
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
25
|
+
/**
|
|
26
|
+
* 通知アクションリポジトリ
|
|
27
|
+
*/
|
|
28
|
+
class InformActionRepo {
|
|
29
|
+
informActionModel;
|
|
30
|
+
constructor(connection) {
|
|
31
|
+
this.informActionModel = connection.model(inform_1.modelName, (0, inform_1.createSchema)());
|
|
32
|
+
}
|
|
33
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
34
|
+
const andConditions = [];
|
|
35
|
+
const idEq = params.id;
|
|
36
|
+
if (typeof idEq === 'string') {
|
|
37
|
+
andConditions.push({ _id: { $eq: idEq } });
|
|
38
|
+
}
|
|
39
|
+
const projectIdEq = params.project?.id?.$eq;
|
|
40
|
+
if (typeof projectIdEq === 'string') {
|
|
41
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
42
|
+
}
|
|
43
|
+
// const objectIdEq = params.object?.id;
|
|
44
|
+
// if (typeof objectIdEq === 'string') {
|
|
45
|
+
// andConditions.push({ 'object.id': { $exists: true, $eq: objectIdEq } });
|
|
46
|
+
// }
|
|
47
|
+
// const objectOrderNumberEq = params.object?.orderNumber;
|
|
48
|
+
// if (typeof objectOrderNumberEq === 'string') {
|
|
49
|
+
// andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
|
|
50
|
+
// }
|
|
51
|
+
// const aboutOrderNumberEq = params.about?.orderNumber;
|
|
52
|
+
// if (typeof aboutOrderNumberEq === 'string') {
|
|
53
|
+
// andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
|
|
54
|
+
// }
|
|
55
|
+
const startDateGte = params.startFrom;
|
|
56
|
+
if (startDateGte instanceof Date) {
|
|
57
|
+
andConditions.push({ startDate: { $gte: startDateGte } });
|
|
58
|
+
}
|
|
59
|
+
const startDateLte = params.startThrough;
|
|
60
|
+
if (startDateLte instanceof Date) {
|
|
61
|
+
andConditions.push({ startDate: { $lte: startDateLte } });
|
|
62
|
+
}
|
|
63
|
+
return andConditions;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* アクション開始
|
|
67
|
+
*/
|
|
68
|
+
async startInformAction(attributes) {
|
|
69
|
+
const startDate = new Date();
|
|
70
|
+
const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
|
|
71
|
+
const creatingAction = {
|
|
72
|
+
...attributes,
|
|
73
|
+
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
74
|
+
startDate,
|
|
75
|
+
expires
|
|
76
|
+
};
|
|
77
|
+
const result = await this.informActionModel.insertMany(creatingAction, { rawResult: true });
|
|
78
|
+
const id = result.insertedIds?.[0]?.toHexString();
|
|
79
|
+
if (typeof id !== 'string') {
|
|
80
|
+
throw new factory_1.factory.errors.Internal('action not saved');
|
|
81
|
+
}
|
|
82
|
+
return { id, startDate, typeOf: creatingAction.typeOf };
|
|
83
|
+
}
|
|
84
|
+
async completeInformAction(params) {
|
|
85
|
+
const doc = await this.informActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
86
|
+
$set: {
|
|
87
|
+
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
88
|
+
result: params.result,
|
|
89
|
+
endDate: new Date()
|
|
90
|
+
}
|
|
91
|
+
}, { new: false, projection: { _id: 1 } })
|
|
92
|
+
.lean()
|
|
93
|
+
.exec();
|
|
94
|
+
if (doc === null) {
|
|
95
|
+
throw new factory_1.factory.errors.NotFound(this.informActionModel.modelName);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* アクション失敗
|
|
100
|
+
*/
|
|
101
|
+
async giveUpInformAction(params) {
|
|
102
|
+
const actionError = Array.isArray(params.error)
|
|
103
|
+
? params.error.map(unknown2actionError_1.unknown2actionError)
|
|
104
|
+
: (0, unknown2actionError_1.unknown2actionError)(params.error);
|
|
105
|
+
const doc = await this.informActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
106
|
+
$set: {
|
|
107
|
+
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
108
|
+
error: actionError,
|
|
109
|
+
endDate: new Date()
|
|
110
|
+
}
|
|
111
|
+
}, { new: true, projection: { _id: 1 } })
|
|
112
|
+
.lean()
|
|
113
|
+
.exec();
|
|
114
|
+
if (doc === null) {
|
|
115
|
+
throw new factory_1.factory.errors.NotFound(this.informActionModel.modelName);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async findInformActions(params, inclusion) {
|
|
119
|
+
const conditions = InformActionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
120
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
121
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
122
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
123
|
+
}
|
|
124
|
+
const projection = {
|
|
125
|
+
_id: 0,
|
|
126
|
+
id: { $toString: '$_id' },
|
|
127
|
+
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
128
|
+
};
|
|
129
|
+
const query = this.informActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
130
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
131
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
132
|
+
query.limit(params.limit)
|
|
133
|
+
.skip(params.limit * (page - 1));
|
|
134
|
+
}
|
|
135
|
+
/* istanbul ignore else */
|
|
136
|
+
if (params.sort?.startDate !== undefined) {
|
|
137
|
+
query.sort({ startDate: params.sort.startDate });
|
|
138
|
+
}
|
|
139
|
+
// const explainResult = await (<any>query).explain();
|
|
140
|
+
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
141
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
142
|
+
.lean() // 2024-08-26~
|
|
143
|
+
.exec();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.InformActionRepo = InformActionRepo;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IPayAction = factory.action.trade.pay.IAction;
|
|
4
5
|
export type IActionRecipe = factory.action.trade.pay.IPayCreditCardRecipe | factory.action.trade.pay.IPayMovieTicketRecipe;
|
|
5
6
|
/**
|
|
6
7
|
* 決済アクションリポジトリ
|
|
7
8
|
*/
|
|
8
9
|
export declare class PayActionRepo extends ActionProcessRepo<IPayAction, IActionRecipe> {
|
|
10
|
+
constructor(connection: Connection);
|
|
9
11
|
/**
|
|
10
12
|
* 決済方法IDから決済アクションをひとつ参照する
|
|
11
13
|
* デフォルトでCompletedActionStatusのみ参照
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PayActionRepo = 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 PayActionRepo 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
|
* 決済方法IDから決済アクションをひとつ参照する
|
|
15
18
|
* デフォルトでCompletedActionStatusのみ参照
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IRefundAction = factory.action.trade.refund.IAction;
|
|
4
5
|
export type IActionRecipe = factory.action.trade.refund.IRefundCreditCardRecipe | factory.action.trade.refund.IRefundMovieTicketRecipe;
|
|
5
6
|
/**
|
|
6
7
|
* 返金アクションリポジトリ
|
|
7
8
|
*/
|
|
8
9
|
export declare class RefundActionRepo extends ActionProcessRepo<IRefundAction, IActionRecipe> {
|
|
10
|
+
constructor(connection: Connection);
|
|
9
11
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RefundActionRepo = void 0;
|
|
4
|
-
|
|
5
|
-
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
6
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
7
|
-
const actionProcess_1 = require("./actionProcess");
|
|
4
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
8
5
|
/**
|
|
9
6
|
* 返金アクションリポジトリ
|
|
10
7
|
*/
|
|
11
8
|
class RefundActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
9
|
+
constructor(connection) {
|
|
10
|
+
super({ connection }, {
|
|
11
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
12
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
13
|
+
});
|
|
14
|
+
}
|
|
12
15
|
}
|
|
13
16
|
exports.RefundActionRepo = RefundActionRepo;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../../factory';
|
|
3
|
+
import { ActionProcessRepo, IActionRecipe } from './anyAction/actionProcess';
|
|
4
|
+
export type ISendAction = factory.action.transfer.send.message.email.IAction;
|
|
5
|
+
/**
|
|
6
|
+
* メッセージ送信アクションリポジトリ
|
|
7
|
+
*/
|
|
8
|
+
export declare class SendEmailMessageActionRepo extends ActionProcessRepo<ISendAction, IActionRecipe<factory.recipe.RecipeCategory.sendEmailMessage>> {
|
|
9
|
+
constructor(connection: Connection);
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendEmailMessageActionRepo = void 0;
|
|
4
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
5
|
+
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
6
|
+
/**
|
|
7
|
+
* メッセージ送信アクションリポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class SendEmailMessageActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
10
|
+
constructor(connection) {
|
|
11
|
+
super({ connection }, {
|
|
12
|
+
expireAfterSeconds: EXPIRE_AFTER_SECONDS,
|
|
13
|
+
recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.SendEmailMessageActionRepo = SendEmailMessageActionRepo;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../../factory';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
4
|
+
export type ISendAction = factory.action.transfer.send.order.IAction;
|
|
5
|
+
/**
|
|
6
|
+
* 注文配送アクションリポジトリ
|
|
7
|
+
*/
|
|
8
|
+
export declare class SendOrderActionRepo extends ActionProcessRepo<ISendAction, never> {
|
|
9
|
+
constructor(connection: Connection);
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendOrderActionRepo = void 0;
|
|
4
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
5
|
+
/**
|
|
6
|
+
* 注文配送アクションリポジトリ
|
|
7
|
+
*/
|
|
8
|
+
class SendOrderActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
9
|
+
constructor(connection) {
|
|
10
|
+
super({ connection }, {
|
|
11
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
12
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.SendOrderActionRepo = SendOrderActionRepo;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unknown2actionError = unknown2actionError;
|
|
4
|
+
// 内部で正規化関数を定義(または外部ヘルパーを呼び出す)
|
|
5
|
+
function unknown2actionError(e) {
|
|
6
|
+
if (e instanceof Error) {
|
|
7
|
+
// Errorオブジェクトの場合は、既存のロジック通り展開
|
|
8
|
+
return { ...e, name: e.name, message: e.message };
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
// Error以外(文字列など)が投げられた場合のハンドリング
|
|
12
|
+
return { name: 'UnknownError', message: String(e) };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { factory } from '../../factory';
|
|
3
|
+
import { IDocType } from '../mongoose/schemas/action/update';
|
|
4
|
+
type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction;
|
|
5
|
+
type IAction<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : never;
|
|
6
|
+
type IActionAttributes<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAttributes : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAttributes : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAttributes : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAttributes : never;
|
|
7
|
+
type IKeyOfProjection = keyof IDocType;
|
|
8
|
+
type IFindParams = factory.action.update.update.IFindParams;
|
|
9
|
+
/**
|
|
10
|
+
* リソース編集アクションリポジトリ
|
|
11
|
+
*/
|
|
12
|
+
export declare class UpdateActionRepo {
|
|
13
|
+
private readonly updateActionModel;
|
|
14
|
+
constructor(connection: Connection);
|
|
15
|
+
static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'id' | 'object' | 'project' | 'result' | 'startFrom' | 'startThrough' | 'typeOf'>): FilterQuery<IDocType>[];
|
|
16
|
+
/**
|
|
17
|
+
* アクション開始
|
|
18
|
+
*/
|
|
19
|
+
startUpdateAction<T extends StartableActionType>(attributes: IActionAttributes<T>): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>>;
|
|
20
|
+
completeUpdateAction(params: {
|
|
21
|
+
typeOf: StartableActionType;
|
|
22
|
+
id: string;
|
|
23
|
+
result: any;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* アクション失敗
|
|
27
|
+
*/
|
|
28
|
+
giveUpUpdateAction(params: {
|
|
29
|
+
typeOf: StartableActionType;
|
|
30
|
+
id: string;
|
|
31
|
+
error: Error | Error[] | unknown;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
findUpdateActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction<StartableActionType>[]>;
|
|
34
|
+
findUpdateActionsBySameAs(params: {
|
|
35
|
+
sameAs: {
|
|
36
|
+
id: {
|
|
37
|
+
$eq: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
|
|
42
|
+
*/
|
|
43
|
+
typeOf: {
|
|
44
|
+
$eq: StartableActionType;
|
|
45
|
+
};
|
|
46
|
+
}): Promise<Pick<IAction<StartableActionType>, 'id' | 'actionStatus' | 'error'>[]>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|