@chevre/domain 26.0.0-alpha.5 → 26.0.0-alpha.6
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/repo/asyncActionLegacy.d.ts +24 -0
- package/lib/chevre/repo/asyncActionLegacy.js +59 -0
- package/lib/chevre/repo/scheduledTaskMigration.d.ts +21 -0
- package/lib/chevre/repo/scheduledTaskMigration.js +70 -0
- package/lib/chevre/repo/task.d.ts +2 -14
- package/lib/chevre/repo/task.js +11 -47
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +12 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Connection, UpdateWriteOpResult } from 'mongoose';
|
|
2
|
+
import { INextFunction } from '../eventEmitter/task';
|
|
3
|
+
import { factory } from '../factory';
|
|
4
|
+
import { IModel } from './mongoose/schemas/task';
|
|
5
|
+
/**
|
|
6
|
+
* 旧非同期アクション(tasksコレクションにて管理)リポジトリ
|
|
7
|
+
*/
|
|
8
|
+
export declare class AsyncActionLegacyRepo {
|
|
9
|
+
readonly taskModel: IModel;
|
|
10
|
+
constructor(connection: Connection);
|
|
11
|
+
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
|
|
12
|
+
alternateName?: never;
|
|
13
|
+
identifier?: never;
|
|
14
|
+
expires: Date;
|
|
15
|
+
}, next: INextFunction): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Readyのままで期限切れのタスクをExpiredに変更する
|
|
20
|
+
*/
|
|
21
|
+
makeExpiredMany(params: {
|
|
22
|
+
expiresLt: Date;
|
|
23
|
+
}): Promise<UpdateWriteOpResult>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncActionLegacyRepo = void 0;
|
|
4
|
+
const task_1 = require("../eventEmitter/task");
|
|
5
|
+
const factory_1 = require("../factory");
|
|
6
|
+
const task_2 = require("./mongoose/schemas/task");
|
|
7
|
+
/**
|
|
8
|
+
* 旧非同期アクション(tasksコレクションにて管理)リポジトリ
|
|
9
|
+
*/
|
|
10
|
+
class AsyncActionLegacyRepo {
|
|
11
|
+
taskModel;
|
|
12
|
+
constructor(connection) {
|
|
13
|
+
this.taskModel = connection.model(task_2.modelName, (0, task_2.createSchema)());
|
|
14
|
+
}
|
|
15
|
+
async runImmediately(params,
|
|
16
|
+
// support customr function(2025-05-25~)
|
|
17
|
+
next) {
|
|
18
|
+
const { expires } = params;
|
|
19
|
+
if (!(expires instanceof Date)) {
|
|
20
|
+
throw new factory_1.factory.errors.Argument('expires', 'must be Date');
|
|
21
|
+
}
|
|
22
|
+
const savingTask = {
|
|
23
|
+
...params,
|
|
24
|
+
status: factory_1.factory.taskStatus.Ready,
|
|
25
|
+
numberOfTried: 0,
|
|
26
|
+
executionResults: []
|
|
27
|
+
};
|
|
28
|
+
const result = await this.taskModel.insertMany(savingTask, { rawResult: true });
|
|
29
|
+
const id = result.insertedIds?.[0]?.toHexString();
|
|
30
|
+
if (typeof id !== 'string') {
|
|
31
|
+
throw new factory_1.factory.errors.Internal('task not saved');
|
|
32
|
+
}
|
|
33
|
+
task_1.taskEventEmitter.emitTaskStatusChanged({
|
|
34
|
+
id,
|
|
35
|
+
status: factory_1.factory.taskStatus.Ready,
|
|
36
|
+
expires // emit expires(2025-03-31~)
|
|
37
|
+
}, next);
|
|
38
|
+
return { id };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Readyのままで期限切れのタスクをExpiredに変更する
|
|
42
|
+
*/
|
|
43
|
+
async makeExpiredMany(params) {
|
|
44
|
+
const { expiresLt } = params;
|
|
45
|
+
if (!(expiresLt instanceof Date)) {
|
|
46
|
+
throw new factory_1.factory.errors.Argument('expiresLt', 'must be Date');
|
|
47
|
+
}
|
|
48
|
+
return this.taskModel.updateMany({
|
|
49
|
+
status: { $eq: factory_1.factory.taskStatus.Ready },
|
|
50
|
+
expires: { $exists: true, $lt: expiresLt }
|
|
51
|
+
}, {
|
|
52
|
+
$set: {
|
|
53
|
+
status: factory_1.factory.taskStatus.Expired
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
.exec();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.AsyncActionLegacyRepo = AsyncActionLegacyRepo;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
/**
|
|
3
|
+
* 予定タスク移行リポジトリ
|
|
4
|
+
*/
|
|
5
|
+
export declare class ScheduledTaskMigrationRepo {
|
|
6
|
+
private readonly scheduledTaskModel;
|
|
7
|
+
private readonly taskModel;
|
|
8
|
+
constructor(connection: Connection);
|
|
9
|
+
/**
|
|
10
|
+
* DeleteTransactionタスク移行処理
|
|
11
|
+
*/
|
|
12
|
+
migrateDeleteTransactionTasks(params: {
|
|
13
|
+
limit: number;
|
|
14
|
+
runsAtGte: Date;
|
|
15
|
+
expiresInDays: number;
|
|
16
|
+
}): Promise<(import("mongodb").BulkWriteResult & {
|
|
17
|
+
mongoose?: {
|
|
18
|
+
validationErrors: import("mongoose").Error[];
|
|
19
|
+
} | undefined;
|
|
20
|
+
}) | undefined>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ScheduledTaskMigrationRepo = void 0;
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
const factory_1 = require("../factory");
|
|
9
|
+
const scheduledTasks_1 = require("./mongoose/schemas/scheduledTasks");
|
|
10
|
+
const task_1 = require("./mongoose/schemas/task");
|
|
11
|
+
/**
|
|
12
|
+
* 予定タスク移行リポジトリ
|
|
13
|
+
*/
|
|
14
|
+
class ScheduledTaskMigrationRepo {
|
|
15
|
+
scheduledTaskModel;
|
|
16
|
+
taskModel;
|
|
17
|
+
constructor(connection) {
|
|
18
|
+
this.scheduledTaskModel = connection.model(scheduledTasks_1.modelName, (0, scheduledTasks_1.createSchema)());
|
|
19
|
+
this.taskModel = connection.model(task_1.modelName, (0, task_1.createSchema)());
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* DeleteTransactionタスク移行処理
|
|
23
|
+
*/
|
|
24
|
+
async migrateDeleteTransactionTasks(params) {
|
|
25
|
+
const { limit, runsAtGte, expiresInDays } = params;
|
|
26
|
+
// limit件抽出
|
|
27
|
+
const migratingTasks = await this.taskModel.find({
|
|
28
|
+
// _id: { $eq: '6a66e83f9b21f3d4bf5fa232' },
|
|
29
|
+
status: { $eq: factory_1.factory.taskStatus.Ready },
|
|
30
|
+
name: { $eq: factory_1.factory.taskName.DeleteTransaction },
|
|
31
|
+
runsAt: { $gte: runsAtGte }
|
|
32
|
+
})
|
|
33
|
+
.limit(limit)
|
|
34
|
+
.lean()
|
|
35
|
+
.exec();
|
|
36
|
+
if (migratingTasks.length === 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
;
|
|
40
|
+
const bulkOps = migratingTasks.map((migratingTask) => {
|
|
41
|
+
return {
|
|
42
|
+
updateOne: {
|
|
43
|
+
filter: {
|
|
44
|
+
_id: { $eq: migratingTask._id }
|
|
45
|
+
},
|
|
46
|
+
update: {
|
|
47
|
+
$setOnInsert: {
|
|
48
|
+
...migratingTask,
|
|
49
|
+
expires: (0, moment_1.default)(migratingTask.runsAt)
|
|
50
|
+
.add(expiresInDays, 'days')
|
|
51
|
+
.toDate()
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
upsert: true
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
// 新コレクションへ挿入
|
|
59
|
+
const result = await this.scheduledTaskModel.bulkWrite(bulkOps, { ordered: false });
|
|
60
|
+
// 新コレクションへ書き込めたIDだけを旧DBから削除
|
|
61
|
+
const successfulIds = [];
|
|
62
|
+
migratingTasks.forEach(d => successfulIds.push(d._id));
|
|
63
|
+
if (successfulIds.length > 0) {
|
|
64
|
+
await this.taskModel.deleteMany({ _id: { $in: successfulIds } })
|
|
65
|
+
.exec();
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ScheduledTaskMigrationRepo = ScheduledTaskMigrationRepo;
|
|
@@ -16,13 +16,6 @@ type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | '
|
|
|
16
16
|
export declare class TaskRepo {
|
|
17
17
|
readonly taskModel: IModel;
|
|
18
18
|
constructor(connection: Connection);
|
|
19
|
-
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
|
|
20
|
-
alternateName?: never;
|
|
21
|
-
identifier?: never;
|
|
22
|
-
expires: Date;
|
|
23
|
-
}, next: INextFunction): Promise<{
|
|
24
|
-
id: string;
|
|
25
|
-
}>;
|
|
26
19
|
saveMany(taskAttributes: ICreatingTask[]): Promise<{
|
|
27
20
|
id: string;
|
|
28
21
|
}[]>;
|
|
@@ -42,8 +35,9 @@ export declare class TaskRepo {
|
|
|
42
35
|
/**
|
|
43
36
|
* タスク識別子から冪等作成する
|
|
44
37
|
* reimplement createIfNotExistByIdentifier(2025-03-28~)
|
|
38
|
+
* reimplement runTaskByIdentifier(2026-08-03~)
|
|
45
39
|
*/
|
|
46
|
-
|
|
40
|
+
runTaskByIdentifier(params: ICreatingTask & {
|
|
47
41
|
alternateName: string;
|
|
48
42
|
identifier: string;
|
|
49
43
|
expires?: never;
|
|
@@ -120,12 +114,6 @@ export declare class TaskRepo {
|
|
|
120
114
|
};
|
|
121
115
|
nameFilterBeforeRunsAt: boolean;
|
|
122
116
|
}): Promise<Pick<factory.task.ITask<factory.taskName>, 'id' | 'name'> | null>;
|
|
123
|
-
/**
|
|
124
|
-
* Readyのままで期限切れのタスクをExpiredに変更する
|
|
125
|
-
*/
|
|
126
|
-
makeExpiredMany(params: {
|
|
127
|
-
expiresLt: Date;
|
|
128
|
-
}): Promise<UpdateWriteOpResult>;
|
|
129
117
|
/**
|
|
130
118
|
* Runningのまま一定期間超過し、かつ、remainingNumberOfTries>0のタスクをReadyに変更する
|
|
131
119
|
*/
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -48,31 +48,6 @@ class TaskRepo {
|
|
|
48
48
|
constructor(connection) {
|
|
49
49
|
this.taskModel = connection.model(task_2.modelName, (0, task_2.createSchema)());
|
|
50
50
|
}
|
|
51
|
-
async runImmediately(params,
|
|
52
|
-
// support customr function(2025-05-25~)
|
|
53
|
-
next) {
|
|
54
|
-
const { expires } = params;
|
|
55
|
-
if (!(expires instanceof Date)) {
|
|
56
|
-
throw new factory_1.factory.errors.Argument('expires', 'must be Date');
|
|
57
|
-
}
|
|
58
|
-
const savingTask = {
|
|
59
|
-
...params,
|
|
60
|
-
status: factory_1.factory.taskStatus.Ready,
|
|
61
|
-
numberOfTried: 0,
|
|
62
|
-
executionResults: []
|
|
63
|
-
};
|
|
64
|
-
const result = await this.taskModel.insertMany(savingTask, { rawResult: true });
|
|
65
|
-
const id = result.insertedIds?.[0]?.toHexString();
|
|
66
|
-
if (typeof id !== 'string') {
|
|
67
|
-
throw new factory_1.factory.errors.Internal('task not saved');
|
|
68
|
-
}
|
|
69
|
-
task_1.taskEventEmitter.emitTaskStatusChanged({
|
|
70
|
-
id,
|
|
71
|
-
status: factory_1.factory.taskStatus.Ready,
|
|
72
|
-
expires // emit expires(2025-03-31~)
|
|
73
|
-
}, next);
|
|
74
|
-
return { id };
|
|
75
|
-
}
|
|
76
51
|
async saveMany(taskAttributes) {
|
|
77
52
|
const emitImmediately = true; // always true(2026-07-30~)
|
|
78
53
|
// const emitImmediately = options?.emitImmediately === true;
|
|
@@ -132,17 +107,24 @@ class TaskRepo {
|
|
|
132
107
|
/**
|
|
133
108
|
* タスク識別子から冪等作成する
|
|
134
109
|
* reimplement createIfNotExistByIdentifier(2025-03-28~)
|
|
110
|
+
* reimplement runTaskByIdentifier(2026-08-03~)
|
|
135
111
|
*/
|
|
136
|
-
async
|
|
112
|
+
async runTaskByIdentifier(params) {
|
|
137
113
|
const emitImmediately = true; // always true(2026-07-30~)
|
|
114
|
+
if (typeof params.identifier !== 'string' || params.identifier.length === 0) {
|
|
115
|
+
throw new factory_1.factory.errors.ArgumentNull('identifier');
|
|
116
|
+
}
|
|
138
117
|
if (typeof params.alternateName !== 'string' || params.alternateName.length === 0) {
|
|
139
118
|
throw new factory_1.factory.errors.ArgumentNull('alternateName');
|
|
140
119
|
}
|
|
120
|
+
if (params.identifier !== params.alternateName) {
|
|
121
|
+
throw new factory_1.factory.errors.Argument('identifier,alternateName not matched');
|
|
122
|
+
}
|
|
141
123
|
let createdTask;
|
|
142
124
|
const filterQuery = {
|
|
143
125
|
'project.id': { $eq: params.project.id },
|
|
144
126
|
name: { $eq: params.name },
|
|
145
|
-
|
|
127
|
+
identifier: { $exists: true, $eq: params.identifier }
|
|
146
128
|
};
|
|
147
129
|
const projection = {
|
|
148
130
|
_id: 0,
|
|
@@ -160,7 +142,7 @@ class TaskRepo {
|
|
|
160
142
|
catch (error) {
|
|
161
143
|
let throwsError = true;
|
|
162
144
|
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
163
|
-
// すでに
|
|
145
|
+
// すでにidentifierが存在する場合ok
|
|
164
146
|
throwsError = false;
|
|
165
147
|
createdTask = await this.taskModel.findOne(filterQuery, projection)
|
|
166
148
|
.lean()
|
|
@@ -180,7 +162,7 @@ class TaskRepo {
|
|
|
180
162
|
}
|
|
181
163
|
}
|
|
182
164
|
else {
|
|
183
|
-
throw new factory_1.factory.errors.Internal(`falied in creating a task unexpectedly. ${params.
|
|
165
|
+
throw new factory_1.factory.errors.Internal(`falied in creating a task unexpectedly. ${params.identifier}`);
|
|
184
166
|
}
|
|
185
167
|
}
|
|
186
168
|
// /**
|
|
@@ -422,24 +404,6 @@ class TaskRepo {
|
|
|
422
404
|
task_1.taskEventEmitter.emitTaskStatusChanged(changedTask);
|
|
423
405
|
return doc;
|
|
424
406
|
}
|
|
425
|
-
/**
|
|
426
|
-
* Readyのままで期限切れのタスクをExpiredに変更する
|
|
427
|
-
*/
|
|
428
|
-
async makeExpiredMany(params) {
|
|
429
|
-
const { expiresLt } = params;
|
|
430
|
-
if (!(expiresLt instanceof Date)) {
|
|
431
|
-
throw new factory_1.factory.errors.Argument('expiresLt', 'must be Date');
|
|
432
|
-
}
|
|
433
|
-
return this.taskModel.updateMany({
|
|
434
|
-
status: { $eq: factory_1.factory.taskStatus.Ready },
|
|
435
|
-
expires: { $exists: true, $lt: expiresLt }
|
|
436
|
-
}, {
|
|
437
|
-
$set: {
|
|
438
|
-
status: factory_1.factory.taskStatus.Expired
|
|
439
|
-
}
|
|
440
|
-
})
|
|
441
|
-
.exec();
|
|
442
|
-
}
|
|
443
407
|
/**
|
|
444
408
|
* Runningのまま一定期間超過し、かつ、remainingNumberOfTries>0のタスクをReadyに変更する
|
|
445
409
|
*/
|
|
@@ -16,6 +16,7 @@ import type { CheckThingActionRepo } from './repo/action/checkThing';
|
|
|
16
16
|
import type { PayActionRepo } from './repo/action/pay';
|
|
17
17
|
import type { RefundActionRepo } from './repo/action/refund';
|
|
18
18
|
import type { AsyncActionRepo } from './repo/asyncAction';
|
|
19
|
+
import type { AsyncActionLegacyRepo } from './repo/asyncActionLegacy';
|
|
19
20
|
import type { AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
20
21
|
import type { AdminAsyncActionRepo } from './repo/adminAsyncAction';
|
|
21
22
|
import type { AdminScheduledTaskRepo } from './repo/adminScheduledTask';
|
|
@@ -505,6 +506,10 @@ export type AsyncAction = AsyncActionRepo;
|
|
|
505
506
|
export declare namespace AsyncAction {
|
|
506
507
|
function createInstance(...params: ConstructorParameters<typeof AsyncActionRepo>): Promise<AsyncActionRepo>;
|
|
507
508
|
}
|
|
509
|
+
export type AsyncActionLegacy = AsyncActionLegacyRepo;
|
|
510
|
+
export declare namespace AsyncActionLegacy {
|
|
511
|
+
function createInstance(...params: ConstructorParameters<typeof AsyncActionLegacyRepo>): Promise<AsyncActionLegacyRepo>;
|
|
512
|
+
}
|
|
508
513
|
export type Ticket = TicketRepo;
|
|
509
514
|
export declare namespace Ticket {
|
|
510
515
|
function createInstance(...params: ConstructorParameters<typeof TicketRepo>): Promise<TicketRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
|
|
4
|
-
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = void 0;
|
|
4
|
+
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncActionLegacy = exports.AsyncAction = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = void 0;
|
|
5
5
|
var AcceptedOffer;
|
|
6
6
|
(function (AcceptedOffer) {
|
|
7
7
|
let repo;
|
|
@@ -1066,6 +1066,17 @@ var AsyncAction;
|
|
|
1066
1066
|
}
|
|
1067
1067
|
AsyncAction.createInstance = createInstance;
|
|
1068
1068
|
})(AsyncAction || (exports.AsyncAction = AsyncAction = {}));
|
|
1069
|
+
var AsyncActionLegacy;
|
|
1070
|
+
(function (AsyncActionLegacy) {
|
|
1071
|
+
let repo;
|
|
1072
|
+
async function createInstance(...params) {
|
|
1073
|
+
if (repo === undefined) {
|
|
1074
|
+
repo = (await import('./repo/asyncActionLegacy.js')).AsyncActionLegacyRepo;
|
|
1075
|
+
}
|
|
1076
|
+
return new repo(...params);
|
|
1077
|
+
}
|
|
1078
|
+
AsyncActionLegacy.createInstance = createInstance;
|
|
1079
|
+
})(AsyncActionLegacy || (exports.AsyncActionLegacy = AsyncActionLegacy = {}));
|
|
1069
1080
|
var Ticket;
|
|
1070
1081
|
(function (Ticket) {
|
|
1071
1082
|
let repo;
|
|
@@ -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) {
|
|
@@ -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
|
}
|
|
@@ -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
|
// {
|
|
@@ -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
|
}
|
|
@@ -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:
|
|
@@ -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
|
};
|
package/package.json
CHANGED